我有一些自定义PHP页面,我正在使用一个WordPress站点。我想通过GET方法使用干净的URL,其中有一些变量。我已经搜索并尝试了不同版本的htaccess代码,并结合下面的WordPress htaccess代码,但没有成功。PHP获取变量清洁url htaccess
我想用户浏览并使用的URL是www.thedomain.com/thefolder/details/123456/RES,而不是www.thedomain.com/thefolder/details.php?mls=123456 & ret = RES
我已将我的代码放入根目录中的htaccess文件中。我也尝试过在detail.php文件所在目录下的htaccess中。
RewriteEngine On
## WordPress code
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./ /index.php [L]
## my code
RewriteBase /thefolder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9]+)$ details.php?mls=$1&ret=$2
RewriteRule ^([a-zA-Z0-9]+)/$ details.php?mls=$1&ret=$2
_Will redirect page_1.html?a = 2 ..._ - 你确定'RewriteRule' _redirects_? – ShuklaSannidhya 2013-03-16 06:33:39
测试一下,如果它不起作用,请提供有关您的体验的反馈。这样我们可以解决重定向问题,直到它正常工作 – OmniPotens 2013-03-16 06:37:28
嘿,我想说'RewriteRule'不会重定向,它只是重写url。 – ShuklaSannidhya 2013-03-16 06:38:34