htaccess rewriteRule修复

时间:2012-09-24 06:44:39

标签: php rewrite

我在这里没什么问题

http//site.com/detial.php?verifyID=$parametre

我希望这就像短网址:

http://site.com/$parametre
我们怎么办? 谢谢

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^([^/]*)\$ /detial.php?parametre=$1 [L]
# Error Pages
ErrorDocument 404 /404.php
<Files 403.shtml>
order allow,deny
allow from all
</Files>

我正在使用此但却出现404错误 我们该如何解决

1 个答案:

答案 0 :(得分:0)

假设PHP

header("content-type: text/plain");
if (isset($_GET['q']))
  echo $_GET['q'];
else
  echo "empty";

您可以通过以下

获取$_GET['q']中的网址
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?q=$1 [QSA,L]
</IfModule>

请注意,它还会检查所请求的资源是否是文件系统中的现有文件!-f或目录!-d