2011-11-26 55 views
0

一個Joomla網站上的工作,確實使用了sh404sef改變舊的結局url.html到URL/重定向上的Joomla剝離網址與sh404sef的.htaccess

但後來我ofcourse想要做301重定向的舊的.html新的,sh404sef不這樣做,我可以通過網址做到這一點,但這不是在這種情況下的選項。

一直在使用.htaccess嘗試一切,但我不能只是得到它的工作,不知道是否有任何其他事情在.htaccess或sh404sef重寫此,需要一個解決方案。

這裏是htaccess的

RewriteEngine On 

########## Begin - Rewrite rules to block out some common exploits 
## If you experience problems on your site block out the operations listed below 
## This attempts to block the most common type of exploit `attempts` to Joomla! 
# 
# Block out any script trying to set a mosConfig value through the URL 
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR] 
# Block out any script trying to base64_encode crap to send via URL 
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR] 
# Block out any script that includes a <script> tag in URL 
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] 
# Block out any script trying to set a PHP GLOBALS variable via URL 
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] 
# Block out any script trying to modify a _REQUEST variable via URL 
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) 
# Send all blocked request to homepage with 403 Forbidden error! 
RewriteRule ^(.*)$ index.php [F,L] 
# 
########## End - Rewrite rules to block out some common exploits 

# Uncomment following line if your webserver's URL 
# is not directly related to physical file paths. 
# Update Your Joomla! Directory (just/for root) 

# RewriteBase/



########## Begin - Joomla! core SEF Section 
# 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !^/index.php 
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC] 
RewriteRule (.*) index.php 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 
# 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/ 
RewriteRule ^(([^/]+/)*)index\.html$ http://www.example.com/$1 [R=301,L] 

########## End - Joomla! core SEF Section 

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^/]+).html$ $1/ [R=301,NC] 
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.html 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$ 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^/]+)/$ $1.php 
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$ 
RewriteRule (.*)$ /$1 [R=301,L] 




php_flag display_errors off 
php_flag register_globals off 

php_value memory_limit 64M 

所以要澄清一切

這是>http://www.website.com/page.html

現在http://www.website.com/page/

當有人打在舊的.html URL的他們得到一個404和它殺害遊客和SEO。在htaccess中嘗試了所有通常的命令來做到這一點,但它不起作用。需要建議如何解決這個問題!

回答

0

事情是這樣的 - 其他規則之前 - 但你先打開RewriteEngine敘述

RewriteCondition %{REQUEST_FILENAME} !-f 
RewriteRule (.*)\.html$ $1/ [R=301] 

順便後 - 你似乎有RewriteEngine敘述上的多個實例 - 這可能會導致服務器在某些服務器上500錯誤。

0

工作對我來說是這樣的:

Options +FollowSymLinks 
RewriteEngine On 

RewriteBase /yourfolderjoomla/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !^/index.php 
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC] 
RewriteRule (.*) index.php 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]