2014-01-23 137 views
1

1碼不在文件夾1工作不工作,因爲我使用2的代碼隱藏 子隱藏PHP擴展和隱藏子目錄都在同一個網址在.htaccess

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 
1code to hide .php 

Options +FollowSymlinks 
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ $1.php 

2code to hide sub folder 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^(.*)$ /folder/$1 [L] 

回答

0

嘗試此代碼:

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] 
+0

您要求的頁面不可用 一般錯誤或已發生 – mridul

+0

其工作,但在我的其他網站 – mridul

+0

2個網站之間有什麼區別? – anubhava