我需要你的帮助我正在尝试更改我的网址格式,但我无法做到这一点我不断收到Object Not Found
错误。
真实网址为:http://localhost/website/page.php?pid=about
我想要使用htaccess http://localhost/website/about.php
这个网址我的代码是:
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php !-f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(([a-zA-z0-9\_\-\+]+))\.html|([a-zA-z0-9\_\-]+)\.php$ page.php?pptype=$2&pppage=$3&id=$4 [QSA,NC,L]
</IfModule>
答案 0 :(得分:0)
请尝试使用类似于http://localhost/website/about.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewrwiteRule ^([\w-]+)/([\w-]+).php$ $1/page.php?pid=$2 [L]
答案 1 :(得分:0)
在.htaccess
:
RewriteEngine On
RewriteRule ^website/([^/]*)\.php$ /website/page.php?pid=$1 [L]
它将为您留下以下网址:http://localhost/website/about.php