网址重写我的网站

时间:2014-07-30 07:27:42

标签: php .htaccess url mod-rewrite

我已尝试使用以下代码重写我网站上的网址,但其工作不正常

RewriteEngine on
RewriteRule about/page_id/(.*)/ productlist.php?page_id=$1

不能正常工作

但是代码工作正常......

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php
RewriteRule ^index\.php$ / [L,R=301]
RewriteCond %{HTTP_HOST} !^floratonic\.com
RewriteRule (.*) http://floratonic.com/$1 [R=301,L]

我需要重写此网址的建议

http://floratonic.com/productlist.php?page_id=44

http://floratonic.com/productlist.php/44/

OR

http://floratonic.com/productlist.php/PAGENAME/

2 个答案:

答案 0 :(得分:0)

尝试:

RewriteCond %{REQUEST_URI} !^/about/page_id/(.*)$ [NC]

RewriteRule  ^about/page_id/(.*)/ productlist.php?page_id=$1

答案 1 :(得分:0)

您可以尝试简单地说:

RewriteEngine on
RewriteRule ^about/page_id/(.*)/ productlist.php?page_id=$1 [NC, L]