2017-05-07 117 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错误完美,谢谢 –