2017-02-26 103 views
0

我在HTML文件夾的.htaccess URL重寫規則的文件夾

--html 
    --.htaccess 
    --app 
     --application_name 
     --public 
      --index.php 
    --landing_page 
    --index.php 

至於有現在這個樣子,每次網站訪問URL(www.website.com),瀏覽器打開LANDING_PAGE/index.php文件。

我怎樣才能使,當我訪問www.website.com/beta,我會做的HTML請求/應用程序/應用程序名稱/公/ index.php文件

我曾嘗試加入這個到的.htaccess

RewriteRule ^beta/?$ app/application_name/public/index.php [L,NC] 

這是整個的.htaccess

RewriteEngine On 
RewriteBase/
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 

RewriteRule ^beta/?$ app/application_name/public/index.php [L,NC] 

但它不工作。不知道用什麼詞來搜索這類問題。

回答

0

您的根目前設置爲/ html,因此RewriteBase /位於//beta/根本不存在。您可以更改RewriteBase /app/application_home/public/並設置RewriteRule ^beta/?$ index.php [L,NC]。然而,這不再讓您訪問着陸頁,不知道這是你想要的嗎?

+0

我需要着陸頁仍然可以 – Ponce

+0

然後在'/ app/application_home/public /'目錄下創建一個單獨的.htaccess文件,使用'RewriteBase/app/application_home/public /',重寫規則爲'RewriteRule^beta /?$ index.php [L,NC]' – hcheung

+0

什麼是完整的.htaccess? – Ponce