对不起,我改变了previous问题。我有问题,在本地主机上的.htaccess重写规则,我的.htaccess文件中的http://本地主机/测试/的.htaccess。 我想改变URL中包含
Sorry I changed the previous question. I have problem with .htaccess rewrite rule on localhost, I have .htaccess file in http:// localhost/testing/.htaccess. I want to change url like below
http://localhost/testing/site.php?site=test
到
http://localhost/testing/test
和我有code在.htaccess为
And I have code in .htaccess as
RewriteEngine on
RewriteRule ^([^/.]+)/?$ site.php?site=$1 [L]
这是工作正确的,但我也URL如
Which is working correct, but I have also url like
http://localhost/testing/pages.php?site=test&pid=2
下面pages.php有两个参数,网站名称和页面ID。我想改写这个为
Here pages.php with two parameters as site name and page id. I want rewrite this as
http://localhost/testing/test/2
对于这两种情况我有波纹管code这是行不通的。
For both conditions I have bellow code which is not working
RewriteEngine on
RewriteRule ^([^/.]+)/?$ site.php?site=$1 [L]
RewriteRule ^([^/.]+)/?$ pages.php?site=$1&pid=$2 [L]
请帮
感谢:)
我该为我工作的解决方案。
I got solution which worked for me.
RewriteEngine on
RewriteRule ^([^/.]+)/?$ site.php?site=$1 [L]
RewriteRule ^([^/]+)/([^/.]+)/?$ pages.php?site=$1&pid=$2 [L,QSA]
谢谢大家:)
Thanks everyone :)