为后续URL创建重写条件

时间:2014-10-01 18:07:53

标签: .htaccess mod-rewrite url-rewriting

我有以下网址

http://localhost/dyescan/pair_pixel_filter?type=0

我想为它重写规则和写条件,到目前为止我已经完成了这个

<ifModule mod_rewrite.c>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /dyescan/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+([^.]+)\.php\?type=([^\s&]+)\s [NC]
RewriteRule ^ /%1/%2.html? [R=301,L]

#Make sure it's not an actual file
RewriteCond %{REQUEST_FILENAME} !-f
#Make sure its not a directory
RewriteCond %{REQUEST_FILENAME} !-d 
#Rewrite the request to index.php
RewriteRule ^(.*)$ index.php [L]
</ifModule>

这里发生的是我得到了我想要的页面,但是,如果有另外一个xpage这样的话,我现在也无法访问我的CSS库

localhost/dyescan/sompage.php?test=1

它将我重定向到appache默认页面。这是什么解决方法?

1 个答案:

答案 0 :(得分:1)

变化:

RewriteRule ^ /%1/%2? [R=301,L]

RewriteRule ^ /%1/%2.html? [R=301,L]