htaccess的符号,以问号删除的index.php [英] .htaccess ampersand to question mark and remove index.php

查看:94
本文介绍了htaccess的符号,以问号删除的index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从更改网址 http://example.com/index.php?city=newyork& ;猫=苹果&放大器; Q = iPad的 http://example.com/newyork?cat=apple&q=ipad

i want change url from http://example.com/index.php?city=newyork&cat=apple&q=ipad TO http://example.com/newyork?cat=apple&q=ipad

请帮我。

我的.htaccess

I have .htaccess

DirectoryIndex index.php

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^/([a-z]+)(?:$|\?(?:.+)) /index.php?city=$1 [NC,L,B,QSA,NE]

不过,这并不正常工作

But it doesn't work

推荐答案

试试这个规则:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ /index.php?city=$1 [L,QSA]

这篇关于htaccess的符号,以问号删除的index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆