如何删除所有查询字符串和扩展页面到修改版本

时间:2014-10-01 10:17:59

标签: .htaccess mod-rewrite

我的.htaccess文件中有这段代码:

RewriteEngine On

RewriteRule \.(css|jpe?g|gif|png|js)$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^authors/([^/]*)$ authors.php?current_page=$1 [NC,L]

RewriteRule ^([^/]*)/([^/]*)$ books.php?tag=$1&current_page=$2 [NC,L]

RewriteRule ^Books-single/([^/]*)/([^/]*)$ book-single.php?tag=$1&id=$2 [NC,L]

RewriteRule ^Books-by/([^/]*)/([^/]*)$ book-by.php?auth=$1&current_page=$2 [NC,L]

RewriteRule ^authors-by/([^/]*)/([^/]*)$ authors-by.php?author-by=$1&current_page=$2 [NC,L]

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

当我输入dunamic url时,地址栏就像localhost:/somefolder/books.php?tag = Love-Books& page = 2这个url仍然有用,我希望所有带查询的url重定向到它的静态版本网址。

0 个答案:

没有答案