,而不是假設我有我的網站上像這樣的文件:子域名重定向到一個特定的文件的文件夾
example.com/pages/live_report.php
,現在我想,當用戶鍵入URL live.example.com,它指到上面的文件沒有我是強制重命名它。
我該怎麼做通過htaccess?
當然我嘗試這個規則,建議上Redirect a subdomain to a directory using .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^live\.example\.com
RewriteRule ^(.*)$ /pages/live_report.php$1 [L]
但這不工作
我不想重定向live.example.com到該文件只是它是一個http://live.example.com/pages/live_report.php URL rewrited但是我測試你在Chrome中排除,但不顯示發現錯誤 – 2012-03-16 16:28:55
你有'live_report.php'在正確的文件夾? – scibuff 2012-03-16 16:31:04
是的,這是正確的。但注意:當我通過cPanel創建一個新的子域時,顯示此消息,並在幾個小時後顯示正確並正常工作。是否有可能導致這個問題 – 2012-03-16 16:37:28