简体   繁体   English

网址重写规则不起作用

[英]URL rewrite rule is not working

My url is http://example.com/index.php?pid=software_details&p=18 I want to change my url to http://example.com/software_details/18 . 我的网址是http://example.com/index.php?pid=software_details&p=18我想将我的网址更改为http://example.com/software_details/18 I used .htaccess file to do this but it's not working... please someone help me! 我使用.htaccess文件来执行此操作,但是它无法正常工作...请有人帮我! thanks in advance...! 提前致谢...!

My .htaccess code is as bellow: 我的.htaccess代码如下所示:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/([^/]*)/([^/]*) /index.php?pid=$1&p=$2 [L]
</IfModule>

我认为以下规则应该可以满足您的需求:

RewriteRule ^/(.*)/(.*)$ /index.php?pid=$1&p=$2 [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM