簡體   English   中英

通過htaccess將所有joomla頁面重定向到.html

[英]Redirect all joomla pages to .html via htaccess

在我的joomla 2.5安裝中,我已經安裝了mijosef,但是如果執行以下操作,如果我轉到www.mywebsite.com/name,它將返回錯誤404。如果我轉到www.mywebsite.com/name.html,則可以。 支持人員告訴我,我可以通過htacces處理此問題,但我嘗試了在此處和其他論壇中找到的解決方案,但未成功。

我試圖插入此代碼:

RewriteRule (.+)/$ /$1.html [L,R=301]

但是什么都沒有改變。 我該如何解決?

謝謝

編輯:這是我的htaccess(我用#刪除了初始部分)

##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
#  mod_rewrite in use

RewriteEngine On

RewriteRule (.+)/$ /$1.html [L,R=301]
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html|feed|pdf|vcf|raw))$ [NC]
RewriteRule .* index.php [L]

########## 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!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
# 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 data within the URL
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%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})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
########## End - Rewrite rules to block out some common exploits


########## Begin - Joomla! core SEF Section
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw))$ [NC]
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
########## End - Joomla! core SEF Section

嘗試

RewriteRule ^(.*)? /$1.html

看看

嘗試這個;

RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html|feed|pdf|vcf|raw))$ [NC]
RewriteRule .* index.php [L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM