在SO和研究的帮助下,我能够为我的Joomla 2.5网站制作一个.htaccess
文件。
不幸的是,它重写太多,我找不到导致问题的表达。
问题: site.com/administrator
,正在重写为www.site.com
。
Options +FollowSymLinks
RewriteEngine On
## non-www to www
RewriteCond %{HTTP_HOST} ^site.com$ [NC]
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]
## old to new
RewriteRule ^index.php/hello$ /hello.html [L,R=301]
RewriteRule ^index.php/goodbye$ /goodbye.html [L,R=301]
RewriteRule ^this-is/an-old-link.html$ /this-is-now/a-newer-link.html [L,R=301]
RewriteRule ^galleries/docs/folder_web.pdf$ /printstuff/new-folder.html [L,R=301]
## old links with parameters
RewriteCond %{THE_REQUEST} \s/+(?:index\.php)?\?p=21(?:&|\s) [NC]
RewriteRule ^ /new-stuff/wow-sweetie.html? [L,R=301]
RewriteCond %{THE_REQUEST} \s/+(?:index\.php)?\?p=99(?:&|\s) [NC]
RewriteRule ^ /new-stuff/last-exit.html? [L,R=301]
## Begin - Rewrite rules to block out some common exploits.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F,L]
RewriteBase /
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
## sitemap
RewriteCond %{REQUEST_URI} ^/sitemap.xml
RewriteRule .* /index.php?option=com_xmap&view=xml&tmpl=component&id=1&format=html [L]
答案 0 :(得分:0)
尝试添加此规则作为您的第一条规则:
RewriteRule ^administrator(/|$) - [L,NC]