redirect of single page

Topics: Developer Forum, User Forum
Jan 26, 2011 at 2:20 PM

I want to complete a simple task, but I cannot seem to get the right syntax.  I'll apologize ahead of time for my ignorance. 

I want a 301 redirect from http://bossconstruction.com/concrete_contractors_peachtree_city.htm

to:  http://bossconstruction.com/keyword/concrete-contractors-peachtree-city.htm

I have attempted to do this with:

RewriteRule  /concrete_contractors_peachtree_city\.htm /keyword/concrete-contractors-peachtree-city.htm
but no luck.  Tried the full address to escape any directory confusion, since I have several domains that point to different directories:
RewriteCond Host: http\://bossconstruction\.com/concrete_contractors_peachtree_city\.htm
RewriteRule (.*) http\://bossconstruction\.com/keyword/concrete-contractors-peachtree-city\.htm [I,RP]
but no luck.  Perhaps my problem is in the directory structure.  The domain bossconstruction.com points to a folder called bossconstruction.com.  so I tried this:
RewriteRule  bossconstruction.com/concrete_contractors_peachtree_city\.htm bossconstruction.com/keyword/concrete-contractors-peachtree-city.htm
I'm fairly sure that there were several syntax problems there.  Does anyone have any suggestions?  Any help is appreciated.
Jan 27, 2011 at 8:09 AM

How about this one:

RedirectRule ^/concrete_contractors_peachtree_city\.htm$ /keyword/concrete-contractors-peachtree-city.htm [R=301]

The ^ at the start shows that this is the start of the string that you want to match, likewise the $ shows that it's the end.

Next comes where you want the redirect to point to, followed by the 301 redirect.

Hope this helps.

shonk

Jan 27, 2011 at 10:42 AM
still no luck. Thanks for your input, and your explanation. At this point, I may have to escalate a ticket to hosting support to get this done. maybe something is wrong with the install. Other code in the httpd.ini still functions fine though:
### subdomain redirect v2 ###
RewriteCond Host: (?:.+\.)?smartdriveway\.com
RewriteCond URL ^/bossconstruction.com/(.*)
RewriteCond METHOD GET
RewriteRule ^/bossconstruction.com/(.*) /$1 [I,R]
RewriteCond Host: (?:.+\.)?smartdriveway\.com
RewriteCond METHOD POST
RewriteRule ^/bossconstruction.com/(.*) /$1 [I]
RewriteCond Host: (?:.+\.)?smartdriveway\.com
RewriteRule (.*) /bossconstruction.com/$1 [I,L]
and
RewriteCond Host: ^www\.bossconcrete\.com
RewriteRule (.*) http\://bossconstruction\.com$1 [I,RP]
RewriteCond Host: ^bossconcrete\.com
RewriteRule (.*) http\://bossconstruction\.com$1 [I,RP]
these domain redirects work as desired. Is it possible that code for a domain redirect is interfering with code for a page redirect? Every domain I have all points to bossconstruction.com, where the page is found.
Jan 27, 2011 at 10:58 AM

Are you using *this* rewrite tool? The ini files for IIRF are named IIRF.ini, not httpd.ini.

I wonder if you're using another rewrite tool and asking for help in this forum, which will only cause confusion.

Good luck!

shonk

Jan 27, 2011 at 11:01 AM
yes that would be confusing. my hosting provider won’t tell me what version of ISAPI rewrite they have installed. But I take it from your email that with a httpd.ini file, I’m in the wrong place. Thanks for all of your help!
From: [email removed]
Sent: Thursday, January 27, 2011 6:58 AM
To: [email removed]
Subject: Re: redirect of single page [IIRF:243373]

From: shonk

Are you using *this* rewrite tool? The ini files for IIRF are named IIRF.ini, not httpd.ini.

I wonder if you're using another rewrite tool and asking for help in this forum, which will only cause confusion.

Good luck!

shonk

Jan 27, 2011 at 11:03 AM

No probs. Good luck.

shonk

Jan 27, 2011 at 11:03 AM

Oh, maybe take a look at http://www.isapirewrite.com/