我通过.htaccess对301重定向有一个奇怪的问题,我似乎无法找到答案。
我想对单个页面进行永久重定向,如下所示:
旧网页:http://mydomain.com//index.php?option=com_content&view=category&layout=blog&id=1&Itemid=225
我的.htaccess文件看起来像这样。你能告诉我我做错了吗?
#####################################################
## Can be commented out if causes errors, see notes above.
#Options +FollowSymLinks
#
# mod_rewrite in use
RewriteEngine On
########## Begin - 301 Redirect old site pages
Redirect 301 /index.php?option=com_content&view=category&layout=blog&id=1&Itemid=225 http://mydomain.com/banen
########## End - 301 Redirects
########## 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)
#
#Order allow,deny
#Deny from all
#Satisfy all
#
## 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 tag in URL
RewriteCond %{QUERY_STRING} (|%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
RewriteBase /
########## Begin rewrite http:// to http://www.
#
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
#
########## End
# 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
#
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
答案 0 :(得分:0)
而不是第一个Redirect 301
规则具有此mod_rewrite
规则:
RewriteCond %{QUERY_STRING} ^option=com_content&view=category&layout=blog&id=1&Itemid=225$ [NC]
RewriteRule ^index\.php$ /banen/? [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^layout=blog$ [NC]
RewriteRule ^component/content/category/3$ /gaester/? [L,NC,R=301]