.htaccess小问题

时间:2013-01-16 10:48:18

标签: php .htaccess

我有重写规则。

RewriteRule   ^pages/(.+)$   info_pages.php?page_url=$1   [L]

这在以前工作得很好。

我的网址是这样但是在localhost

http://dressgirls.com/demo2/pages/contact-us.html

指向

http://dressgirls.com/demo2/info_pages.php

当我使用这个

echo $_GET['page_url'];
它给了我。 contact-us.html/contact-us.html/contact-us.html

它应该只给contact-us.html一次。

你知道这里有什么问题。?

这是完整的代码

 <IfModule mod_rewrite.c>

 RewriteEngine On

 RewriteRule   ^pages/(.+)$   info_pages.php?page_url=$1   [L]
 RewriteRule   ^reviews/(.+)$   edit_review.php?review_id=$1   [L]
 RewriteRule   ^deals/(.+)$   category.php   [L]
 RewriteRule   ^city/(.+)$   location_deals.php   [L]

 #RewriteCond %{REQUEST_FILENAME} =-f
 #RewriteRule ^(.*)\.php$ $1.html [NC,L]
 #RewriteRule ^(.*)\.html$  $1.php [NC,L]



RewriteCond %{REQUEST_FILENAME} ^(.*)\.html$
RewriteCond %1.php -f
RewriteRule ^(.*)\.html$ $1.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ deal-detail-page.php  [QSA,L]
</IfModule>

感谢。

1 个答案:

答案 0 :(得分:0)

将代码更改为:

RewriteBase  http://dressgirls.com/
RewriteRule   ^pages/(.+)$   info_pages.php?page_url=$1   [L]

然后试试。