2017-05-07 203 views
0

我從來沒有編輯的.htaccess文件之前,所以對不起我的可怕企圖重寫htaccess文件的URL - 刪除查詢字符串

RewriteEngine On 
RewriteCond %{REQUEST_URI} ^/index\.php$ 
RewriteCond %{QUERY_STRING} ^id=([0-9]*)$ 
RewriteRule ^(.*)$ http://example.site/index/%1 [R=302,L] 

我tryting改寫http://ex.com/shop/?s=sa看起來像http://ex.com/shop/sa

+0

你能解釋一下你想要完成什麼嗎? – LvS

+0

嗨,我已更新 –

+0

'RewriteCond%{THE_REQUEST}「\ s/shop/\?s =(\ w *)\ s」' - >'RewriteRule ^「http://example.site/shop/%1 ?」 [R = 302,L]' – Deadooshka

回答

0

我假設您在店鋪目錄中使用rewriterules,並且index.php正在處理數據,請在下面嘗試。

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.+?)$ index.php?s=$1 [L] 
+0

500錯誤完美,謝謝 –