Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在一个url中隐藏php扩展和隐藏子目录在.htaccess中不起作用_Php_Regex_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

在一个url中隐藏php扩展和隐藏子目录在.htaccess中不起作用

在一个url中隐藏php扩展和隐藏子目录在.htaccess中不起作用,php,regex,apache,.htaccess,mod-rewrite,Php,Regex,Apache,.htaccess,Mod Rewrite,1代码在folder1中不起作用,因为我使用2代码隐藏 子文件夹 my site url is looks like this mysite.com/folder1/file and i want this mysite.com/file hide folder1 and .php but it is not working while using 2code any solution 请尝试以下代码: Options +FollowSymlinks -MultiViews RewriteEn

1代码在folder1中不起作用,因为我使用2代码隐藏 子文件夹

my site url is looks like this mysite.com/folder1/file
and i want this mysite.com/file hide folder1 and .php but it is not working while using 2code any solution
请尝试以下代码:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.+?)/?$ /$1.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((?!folder/).+)$ /folder/$1 [L,NC]

您请求的页面不可用发生了一般性错误2个站点之间的差异是什么?
Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.+?)/?$ /$1.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((?!folder/).+)$ /folder/$1 [L,NC]