2011-05-04 65 views
0

調用所有.htaccess權威。我需要你的幫助!htaccess重寫包含#!

我試圖強制重寫包括#!在網址中。

所以基本上我需要。 http://example.com/biography

重新寫入 http://example.com/#!/biography

如果它將使任何區別我重寫規則至今都

 
    RewriteEngine On 
    RewriteCond %{HTTPS} !=on 

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

    RewriteCond $1 !^(images|system|files|themes|static|favicon\.ico|robots\.txt|index\.php) [NC] 
    RewriteRule ^(.*)$ /index.php/$1 [L]

我這個東西,所以任何幫助,將不勝感激吮吸。

此外...

我有這個測試做什麼,我需要在這htaccess的測試人員做的。 http://htaccess.madewithlove.be/但當我嘗試它在我的網站將無法正常工作......

RewriteCond %{REQUEST_URI} !^/#! 
RewriteRule ^(.*)$ /#!/$1 [L]

沒有想法,爲什麼它不會工作?

謝謝, 馬克。

+0

不知道,如果你被允許重寫一個網址的哈希....但可以重定向的工作嗎? – mpen 2011-05-04 06:38:05

+1

#在URL是客戶端,所以你可以做到這一點,只有重定向 – daniels 2011-05-04 09:17:13

回答

5

有你的.htaccess這樣的:

Options +FollowSymlinks -MultiViews 
RewriteEngine on 

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

RewriteRule ^(biography)/?$ /#!/$1 [R,L,NE,NC] 

RewriteCond $1 !^(images|system|files|themes|static|favicon\.ico|robots\.txt|index\.php) [NC] 
RewriteRule ^(.*)$ /index.php/$1 [L] 

記住,你不能有一個條件,因爲這部分是在瀏覽器中,而不是發送到Web服務器處理在.htaccess檢查/#!

+0

Thankyou!似乎要做的伎倆。 – markstewie 2011-05-04 21:06:09