redirection issue

Using a single web hosting account to host multiple sites

redirection issue

Postby SaifQureshi » Tue Jan 23, 2007 2:21 pm

Hi ,

I have to redirect
http://www.domainA.com/333 to http://www.domainA.com/dirA/666.html
I am using this rule
RewriteCond ${HTTP_POST} ^(www\.)?domainA\.com$ [NC]
RewriteCond {REQUEST_URI} ^/333$ [NC]
RewriteRule ^(.*)$ http://www.domainA.com/dirA/666.html [R=301,L,NC]

This works fine, but I also need to redirect
http://www.domainA.com to http://www.domainA.com/xyz/abc.html
for which I use,

RewriteCond ${HTTP_POST} ^(www\.)?domainA\.com$ [NC]
RewriteCond {REQUEST_URI} ^$ [NC]
RewriteRule ^$ http://www.domainA.com/xyz/abc.html [R=301,L,NC]

But that did not work

If I use
RewriteCond ${HTTP_POST} ^(www\.)?domainA\.com$ [NC]
RewriteRule ^(.*)$ http://www.domainA.com/xyz/abc.html [R=301,L,NC]

This works but than it always takes it to this path, no matter what the keyword is after the domain name, so effectively my first rule does not work.

Appreciate any help
SaifQureshi
 
Posts: 1
Joined: Tue Jan 23, 2007 2:03 pm

Postby richardk » Tue Jan 23, 2007 3:23 pm

RewriteCond {REQUEST_URI} ^$ [NC]

REQUEST_URI always contains /. But you shouldn't need those lines anyway.

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?domainA\.com$ [NC]
RewriteRule ^333$ http://www.domainA.com/dirA/666.html [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?domainA\.com$ [NC]
RewriteRule ^$ http://www.domainA.com/xyz/abc.html [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 12 guests

cron