Forum Moderators: phranque

Message Too Old, No Replies

Newb needs a simple apache redirect

I'm close, but no cigar

         

ve3cnu

4:36 pm on Sep 4, 2005 (gmt 0)

10+ Year Member



Right off, I'll admit I'm a newbie in this area.

What I wish to accomplish is have everything under-

www.mysite.com/store/

301 redirect to-

www.mysite.com/

I have this code so far-
Options +FollowSymLinks
RedirectMatch permanent ^/store/*$
[mysite.com...]

This seems to work if I browse to-
www.mysite.com/store/
but if I browse any deeper to say-
www.mysite.com/store/some_url.htm
it does not seem to behave as I'd like.

(www.mysite.com/some_url.htm)

Can anyone help?

jdMorgan

5:28 pm on Sep 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to add a back-reference:

RedirectMatch permanent ^/store(/.*)?$ http://www.mysite.com$1

Jim

ve3cnu

10:39 pm on Sep 4, 2005 (gmt 0)

10+ Year Member



Thanks much Jim.

I'm afraid however that I'm getting some bizarre interaction with some RewriteRule rules I have in place now.

RewriteEngine On
Options +FollowSymLinks
RedirectMatch permanent ^/store(/.*)?$ http://www.example.com$1
RewriteRule ^index.html$ index.php
RewriteRule ^(.*)/(.*)-search-(.*)-(.*)-(.*).html index.php?Operation=ItemSearch&SearchIndex=$1&$2=$3&Sort=$4&ItemPage=$5 [QSA,L]
RewriteRule ^(.*)/(.*)-search-(.*)-(.*).html index.php?Operation=ItemSearch&SearchIndex=$1&$2=$3&Sort=$4 [QSA,L]
RewriteRule ^(.*)/(.*)-search-(.*).html index.php?Operation=ItemSearch&SearchIndex=$1&$2=$3 [QSA,L]
RewriteRule ^(.*)/browse-(.*)-(.*)-(.*).html index.php?Operation=ItemSearch&SearchIndex=$1&BrowseNode=$2&Sort=$3&ItemPage=$4 [QSA,L]
RewriteRule ^(.*)/browse-(.*)-(.*).html index.php?Operation=ItemSearch&SearchIndex=$1&BrowseNode=$2&Sort=$3 [QSA,L]
RewriteRule ^(.*)/browse-(.*).html index.php?Operation=ItemSearch&SearchIndex=$1&BrowseNode=$2 [QSA,L]
RewriteRule ^(.*)/(.*).html index.php?Operation=ItemLookup&ItemId=$1 [QSA,L]
RewriteRule ^(.*).html?$ index.php?SearchIndex=$1 [QSA,L]

What happens now is that a request for-

http://www.example.com/store/B0000223IK/Makita_2703_10__Table_Saw_with_Carbide_Blade.html
goes to-
http://www.example.com/B0000223IK/Makita_2703_10__Table_Saw_with_Carbide_Blade.html?Operation=ItemLookup&ItemId=store/B0000223IK
instead of just-
http://www.example.com/B0000223IK/Makita_2703_10__Table_Saw_with_Carbide_Blade.html

Hope you can help.

[edited by: jdMorgan at 11:58 pm (utc) on Sep. 4, 2005]
[edit reason] No URLs, please. See TOS. [/edit]