Forum Moderators: phranque
I used the following code in my htaccess :
redirect 301/http://house.com [house.com...]
However I can't update my pages onced I entered this command and it didn't redirect. Any suggestions would be greatly appreciated.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule (.*) [domain.com...] [R=301,L]
I don't really understand how it works because I got it from one of the threads here. :)
[edited by: jdMorgan at 2:49 am (utc) on May 4, 2004]
[edit reason] Corrected missing required space [/edit]
I type [domain.www...] in my browser and it redirects to [domain.com...]
jdMorgan,
What space? If it was the space between {HTTTP_HOST} and !^www then it exists in the original although no matter what I try it gets removed by Webmasterworld software. But if it's a different space please let me know.
Why has [NC] dissappeared? Is this unneccessary?
Below is my original with XXX added where the space should be.
RewriteEngine on
RewriteCond %{HTTP_HOST}XXX!^www\.domain\.com [NC]
RewriteRule (.*) [domain.com...] [R=301,L]
Sorry, yes. Posting on this board removes spaces preceding "!" -- unless you type two spaces ! ;)
And - force of habit... Adding [NC] at the end of the domain name means your ruleset will "accept" upper or lowercase domain names without redirecting them, which sort of defeats the purpose of redirecting non-standard domain name requests. Leave [NC] off unless you have a really good reason to want to allow upper-and mixed-case-domain links to remain in the search engine indexes instead of replacing them with all-lowercase-domain links.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
# -FrontPage-
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) [example.com...] [R=301,L]
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName example.web.hosting_service.net
AuthUserFile /home/u3/example/html/_vti_pvt/service.pwd
AuthGroupFile /home/u3/example/html/_vti_pvt/service.grp
Thanks for your help!
[edited by: jdMorgan at 2:24 am (utc) on May 5, 2004]
[edit reason] No specific URLs, please. See TOS [/edit]
If so, place the directive
Options +FollowSymLinks
This will enable mod_rewrite. Sometimes, you won't have priviledges to use Options. If that is the case, then you may get a 500-Server Error response to all requests. So, try this when your server is not busy, and have a backup .htaccess ready to replace the test version if it doesn't work.
Jim