We help IT Professionals succeed at work.

htaccess rewrite to chop out a portion of the url

zattz
zattz asked
on
Hi all,

I have another htaccess rewrite question. I want to "chop out" any portion to the left of the word "store" in a url.

The rewrite must only apply if "store" is in the url

EG:
www.domain.com/any-thing/store/thefile.htm must rewrite to www.domain.com/store/thefile.htm
www.domain.com/any-thing/blah/store/thefile.htm must rewrite to www.domain.com/store/thefile.htm

thanks

Comment
Watch Question

Top Expert 2005
Commented:
In the .htaccess file

Option +FollowSymLinks
RewriteEngine On
RewriteRule .+/store(.*) /store$1 [L]
#note, if You want the user to see the change in it's address bar, change [L] to [L,R=301]

Author

Commented:
Raven,

Thanks again for the help. Works perfectly.

Appreciate it :)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.