Jump to:

23453 Posts in 18902 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » .co.uk to .com 301 redirect goes to sapphire/main.php

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 805 Views
  • marc79
    Community Member
    65 Posts

    .co.uk to .com 301 redirect goes to sapphire/main.php Link to this post


    I am trying to get a .co.uk address that has been pointed to the .com address to not go to /sapphire/main.php.

    The urls are http://www.margotdance.co.uk and http://www.margotdance.com

    The guy who manages .co.uk has told me that he's done a 301 redirect but when I try to access .co.uk end up at http://margotdance.com/sapphire/main.php with the error message:

    "Sorry, it seems you were trying to access a page that doesn't exist."

    I have been looking through and tried many of the .htaccess solutions suggested in this forum but none seem to work for me. I currently have the below in my sites .htaccess file:

    <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond %{HTTP_HOST} ^www\.margotdance\.co\.uk [NC]
       RewriteRule ^(.*) http://www.margotdance.com/$1 [L,R]

       RewriteCond %{REQUEST_URI} ^(.*)$
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]

    Any help would be greatly received



  • simon_w
    Forum Moderator
    471 Posts

    Re: .co.uk to .com 301 redirect goes to sapphire/main.php Link to this post

    The RewriteRule I use for my redirect is:

    RewriteCond %{HTTP_HOST} !^simon.geek.nz
    RewriteRule ^(.*)$ http://simon.geek.nz/$1 [R=301,L]

    The R=301 makes it a 301 redirect, rather than the 302 you're currently giving. The only other main differences I can see is that my rewriterule is ^(.*)$. Not sure if that'll change things, but it is possible.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.