我有限制.htaccess
的知識,我需要一些幫助。我需要做一些重定向來啓用漂亮的網址。 在本地所有的作品都很好,但它不在另一個開發服務器上工作。顯然,查詢字符串在重定向時丟棄。 我需要這個http://mysite.local/info/permalink/1
.htaccess丟失查詢字符串
重定向到這一個http://mysite.local/info?proxy=true&id=1
我.htaccess
代碼:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
#remove /index.php from home url and redirect to root.
#http://mysite.local/index.php -> http://mysite.local/
RewriteCond %{THE_REQUEST} ^.*\/index\.php?\ HTTP/
RewriteRule ^(.*)index\.php?$ "/$1" [R=301,L,QSA]
#pretty url without index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [PT,QSA,L]
#rewrite to handle some permalink saved on my db.
#http://mysite.local/info/permalink/1
#http://mysite.local/info/proxy=true&id=1
RewriteRule ^([^/]+)/info/([a-zA-Z0-9\-]+)/([0-9]+) /info/?proxy=true&id=$3 [L]
</IfModule>
重定向是工作,但查詢字符串不存在。當我的信息模塊上運行var_dump($_GET)
我得到一個空數組array(0) {}
我已經嘗試解決不斷變化的
RewriteRule .* index.php [PT,QSA,L]
到RewriteRule ^(.*)$ /%{QUERY_STRING} [L]
和
RewriteRule ^([^/]+)/info/([a-zA-Z0-9\-]+)/([0-9]+) /info/?proxy=true&idobj=$3 [L]
到
RewriteRule ^([^/]+)/info/([a-zA-Z0-9\-]+)/([0-9]+) /info/?proxy=true&idobj=$3 [QSA,NE,L]
服務器API是CGI/FastCGI的
我應該改變,以確保我的重寫按預期工作和$_GET
變量仍然可以訪問什麼? thx預先
Thx關於答案。我說過,我有限的.htaccess知識。 在我的本地電腦我的htaccess的作品。如果我使用您的修改,它不起作用。但問題不是我的機器,而是測試服務器。無論如何,在測試服務器中,您的解決方案仍然無法工 – user468891