开发者

Rewriting link with .htaccess

开发者 https://www.devze.com 2023-04-13 07:39 出处:网络
I am trying to rewrite links with .htaccess file. Basic stuff, but for some reason it does not wor开发者_开发技巧k. I need the name of the file, before .php to be the last word in URL. What am I missi

I am trying to rewrite links with .htaccess file. Basic stuff, but for some reason it does not wor开发者_开发技巧k. I need the name of the file, before .php to be the last word in URL. What am I missing here?

RewriteRule ^/product/(.*)$ /incl/static/products/$1.php [NC,L]


as Marc said you need something to distinguish the script file name and other parts:

RewriteRule ^products/script/(.*)/(.*)$    $1.php?$2&%{QUERY_STRING}

But if after first (.*) is query string , so use it:

RewriteRule ^products/script/(.*)$    $1.php?%{QUERY_STRING}
0

精彩评论

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

关注公众号