2016-10-10 53 views
2

我一直在尋找並找不到適合我需求的答案。這是一個相當簡單的問題,我假設。.htaccess文件名到url

問題是我需要將我的文件重寫爲我喜歡的名稱。例如,我有,'www.mydomain.com/account_index.php',我想要重寫到www.mydomain.com/account

到目前爲止,我有這個,但似乎並不適用於多行。

Rewriteengine on 
rewriterule ^support account_ticket.php [L] 
rewriterule ^account account_index.php [L] 

因此,在短期,我希望我的網站重定向/帳戶account_index.php和周圍的其他方式。

在此先感謝!

+0

RewriteRule ^支持$ Path/your_php_file_name.php –

回答

1

我找到了那些想知道的答案。 我必須在每RewriteRule之前加上RewriteCond

所以,如果我想去www.mydomain.com/account。我有這個:

RewriteCond %{REQUEST_URI} ^/account$ [NC] 
RewriteRule ^account account_index.php [NC,L] 

這意味着/帳戶現在鏈接到account_index.php。

祝您有美好的一天!