0
改寫像網頁:爲什麼我的重寫規則在最後放了一個問號?
mysite.com/eng/cat
重定向到:
mysite.com/eng?sentence=cat
我做了以下重寫規則:
RewriteCond %{THE_REQUEST} ^GET\ /eng/([^&\s]+) [NC]
RewriteRule ^eng/ eng\?sentence=%1? [R=301,NC,L]
但是當我要求
mysite.com/eng/cat
它重寫這樣
mysite.com/eng?sentence=cat?
我不知道爲什麼它把一個問號結尾,我也嘗試
RewriteCond %{THE_REQUEST} ^GET\ /eng/([^&\s]+) [NC]
RewriteRule ^eng/ eng\?sentence=%1 [R=301,NC,L]
和
RewriteCond %{THE_REQUEST} ^GET\ /eng/([^&\s]+) [NC]
RewriteRule ^eng/ eng\?sentence=%1\? [R=301,NC,L]
這不作任何區別。任何幫助?
我htaccess文件:
# Use PHP5.3 Single php.ini as default
AddHandler application/x-httpd-php54s .php
RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\s/+eng/([^/?&\s]+) [NC]
重寫規則^英句子=%1 [R = 302,NC,L,NE]
AddType application/x-httpd-php .htm .html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Options -Indexes
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
使用Firefox瀏覽器重寫爲/英文句子=貓%3F – user1397417
使用'NE'標誌見編輯? – anubhava
仍然重寫爲eng?sentence = cat%3f – user1397417