开发者

Using .htaccess mod_rewrite to pass all URLs in a given directory to a single redirect script

开发者 https://www.devze.com 2023-02-13 05:27 出处:网络
Im trying to use mod_rewrite to redirect any call to /real-estate/* to rewrite.php...i know i can redirect everything to rewrite.php with this:

Im trying to use mod_rewrite to redirect any call to /real-estate/* to rewrite.php...i know i can redirect everything to rewrite.php with this:

RewriteRule ^(.*)$ rewrite.php?url=$1 [L]

I would like to have my urls formatted like /real-estate/12345/123-anywhere-st ....w开发者_StackOverflow中文版here the 123-anywhere-st would be ignored, and have /real-estate/12345 sent to rewrite.php...id like the rewrite rule to only be used on /real-estate...all other areas of the site should function as is...Ive searched all over for a good tutorial or cheat sheet, but none that I can find actually explain how to format the mod_rewrite rules, they just give one or two examples and thats it...can anyone help, as well as maybe provide a link to somewhere I can learn

Thanks!


RewriteRule ^/real-estate/(.*)$ rewrite.php?url=$1 [L]

0

精彩评论

暂无评论...
验证码 换一张
取 消