繁体   English   中英

使用 .htaccess 重定向注册 URL

[英]Redirect registration url using .htaccess

我想使用.htaccess将注册页面重定向到主页,现在我的代码重定向到服务器上的某个奇怪位置并显示“页面无法正常工作”消息。 但是我希望它重定向到主页。 这怎么可能以及我需要编辑什么? 我猜index.php

# RewriteBase /

# Disable calls to user registration ("register", this url ends with: view=registration))
# Send all blocked request to homepage, use Flag [F] for 403 Forbidden error!
RewriteCond %{QUERY_STRING} (view=registration) [NC]
RewriteRule ^(.*)$ index.php [R]

## Begin - Joomla! core SEF Section.

您收到Page is not working错误消息,因为您的规则将/index.php重定向回自身。 您的所有正则表达式模式^(.*)$也匹配目标 URI /index.php 您需要修复它,以便规则的模式无法匹配目标路径。

您可以使用RewriteCond或将正则表达式更改为((?!index\\.php).*)$

RewriteCond %{QUERY_STRING} (view=registration) [NC]
RewriteRule ^((?index\.php).*)$ index.php [R]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM