2014-01-06 29 views
0

在SO和研究的幫助下,我能夠爲我的Joomla 2.5網站製作一個.htaccess文件。.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

它看起來像你的第一電導率/規則將'非www'重定向到'www'。 '[L]'標誌也意味着這將是最後處理的規則。 – showdev

回答

0

嘗試添加此規則爲您的第一條規則:

RewriteRule ^administrator(/|$) - [L,NC]