可能重复:
重定向*.php以清除URL
我确信这个问题以前在这里被问过,但出于某种原因,我所尝试的似乎都不起作用。
我所拥有的是:http://example.com/share/edit.php?id=59
我想要的是:http://example.com/share/59
我的.htaccess
是:
RewriteEngine on
RewriteRule ^share/([0-9]+)$ share/edit.php?id=$1
我做错什么了吗?.htaccess
文件位于example.com/share
目录中。
如果.htaccess在共享目录中,则不需要指定URL路径。试试这样的东西:
重写引擎打开是否重写规则^(.*)$edit.php?id=$1[QSA,L]
不用说,如果您使用的是apache,则需要启用mod_rewrite。
尝试将.htaccess
放入example.com
目录。
试着这样做:
RewriteEngine On
RewriteRule ^share/([^/]*)$ /share/edit.php?id=$1 [L]
并且.htaccess
文件应该位于根目录中,即example.com
的目录,。CCD_ 8文件夹就在那里。
".htaccess"文件位于"example.com/share"目录中。
将其移动到上级目录(public_html或www)。