Php 如何使用.htaccess重写子文件夹
假设我有这个url:Php 如何使用.htaccess重写子文件夹,php,apache,.htaccess,mod-rewrite,Php,Apache,.htaccess,Mod Rewrite,假设我有这个url: http://www.example.com/page http://www.example.com/page/another-page 我的.htaccess中有以下代码: RewriteEngine On RewriteRule ^([a-z]+)\/?$ index.php?pag=$1 [NC,L] 它可以工作,但如果我转到此url: http://www.example.com/page http://www.example.com/page/anoth
http://www.example.com/page
http://www.example.com/page/another-page
我的.htaccess中有以下代码:
RewriteEngine On
RewriteRule ^([a-z]+)\/?$ index.php?pag=$1 [NC,L]
它可以工作,但如果我转到此url:
http://www.example.com/page
http://www.example.com/page/another-page
它将返回404
在my.htaccess的代码中,我得到了$\u get['page']
基本上,我想将url设置为:
index.php?pag=page/another-page
不返回404。我通常使用以下模式:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
不起作用
/page/a
url也不起作用吗?你能调整你的问题的标题,这样当其他人搜索重写时它就会显示出来吗?如果不起作用,请同时检查你的mod_rewrite是否处于打开状态。。。例如:在数组中('mod_rewrite',apache_get_modules())代码>