0
也許它會顯得很容易,但我有一個與我的.htaccess的問題。我要重寫我的網址,使得<a href="/admin">some text</a>
可以作爲<a href=""http://localhost:8888/madison/the-madison-project/admin/index">some text</a>
設置全局變量來重寫一些URL - .htacess
所以我設置被改寫:
SetEnv root:/madison/the-madison-project/
RewriteRule ^admin[/]?$ {%ENV:root}admin/index
但它不工作。
我該如何解決?
編輯:在多次嘗試後,這也許是我簡單張貼我的整個.htaccess文件
RewriteEngine On
ExpiresActive On
#Expire Header
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "now plus 7 days"
</FilesMatch>
ExpiresByType text/css "now plus 7 days"
ExpiresByType text/html "now plus 7 days"
ExpiresDefault "now plus 7 days"
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
SetEnv root:/madison/the-madison-project/
#SetEnvIf Request_URI^root=/madison/the-madison-project/
#RewriteRule^- [E=root:/madison/the-madison-project/]
RewriteRule ^(assets|inc) - [L]
RewriteRule ^admin[/]?$ %{ENV:root}admin/index
RewriteRule ^admin/edit/(.*)$ %{ENV:root}index.php?type=admin&action=edit&page=$1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^admin/(.*)$ %{ENV:root}index.php?type=admin&action=view&page=$1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^login$ index.php?action=view&type=login&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^forgot-password$ index.php?action=view&type=forgot-password&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^edit/user(/)?$ index.php?action=edit&type=user&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^signup(/)?$ index.php?action=edit&type=user&id=0&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^user/([0-9]+)(/)? index.php?action=view&type=note&user=$1&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^(suggestion|comment)/([0-9]+)(/)? index.php?action=view&type=note&page=open¬e_type=$1¬e=$2&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^([0-9A-Za-z\-_]+)/(suggestion|comment)/([0-9]+)(/)? index.php?action=view&type=note&page=$1¬e_type=$2¬e=$3&%1 [L]
#Catch All Pages
RewriteRule ^index\.php$ - [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^([0-9A-Za-z\-_]+)(/)? %{ENV:root}index.php?action=view&type=page&page=$1&%1 [L]
事實上它沒有工作,在%捲曲的種族面前似乎並沒有被認可... – user1611830 2013-04-09 13:44:03
@ user1611830我沒有看在'SetEnv'正常。請參閱最新的答案。 – 2013-04-09 15:54:52