Forum Moderators: phranque

Message Too Old, No Replies

.htaccess rewrite problem

trying to get a temporary url to point to my site

         

centry

10:25 pm on Feb 7, 2010 (gmt 0)

10+ Year Member



Hi

i have this problem that my webhost has some temporary urls to use before domains are up and running, but sadly google found my temporary url and is now indexing this as my site, instead of my real url, example.com

i have been trying to point my temp. url (6ba7de768d8582b213bb3493f612f1773d9d4542.web7.host-example.com) to my site example.com with this .htaccess file:

RewriteEngine on
rewritecond %{HTTP_HOST} ^6ba7de768d8582b213bb3493f612f1773d9d4542.web7.host-example.com$
rewritecond %{REQUEST_URI} !http://www.example.com
RewriteRule (.*) http://example.com [L]

problem is that now i get a internal server error when i click on the temp url, but example.com and example.com works fine, how can i get the temp url via .htaccess to point at the real url? - problem lies in that both the temp. url and my domain points to the same location at my server, so it will be the same .htaccess people will "see" when they use the temp. url and the real domain.

anyone can help me with this?

[edited by: jdMorgan at 1:45 pm (utc) on Feb 9, 2010]
[edit reason] examplified [/edit]

centry

11:04 pm on Feb 7, 2010 (gmt 0)

10+ Year Member



seems like i found the problem, look like it just need a R=391, and then it worked like a charm.

g1smd

1:43 am on Feb 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



REQUEST_URI will never contain protocol or domain name so will never match.

You have created a back-reference in $1 but failed to re-use it in the target URL.

R=391 should be R=301.