我有一个web项目,其中索引文件位于深层文件夹中。如何隐藏真实的index.php路径
可以说我的项目索引是localhost/xxx/a/b/c/index.php
,但我想隐藏/a/b/c
路径变成localhost/index.php
。
如何编码.htaccess
以及我应该放在哪里?
谢谢。
我有一个web项目,其中索引文件位于深层文件夹中。如何隐藏真实的index.php路径
可以说我的项目索引是localhost/xxx/a/b/c/index.php
,但我想隐藏/a/b/c
路径变成localhost/index.php
。
如何编码.htaccess
以及我应该放在哪里?
谢谢。
尝试在的public_html以下/的.htaccess
RewriteEngine on
#if the request is not for and existent file
RewriteCond %{REQUEST_FILENAME} !-f
#and the request is not for and existent directory
RewriteCond %{REQUEST_FILENAME} !-d
#then rewrite it to /a/b/c/request
RewriteRule ^(?:xxx/)?(.*)$ /xxx/a/b/c/$1 [NC,L]
这将内部重定向
example.com/file.php
到
example.com/a/b/c/file.php
只是让** C **网站根 –