简体   繁体   English

使用 .htaccess 重定向注册 URL

[英]Redirect registration url using .htaccess

I would like to redirect registration page to homepage by using .htaccess now my code is redirecting to some strange location on the server and displaying "Page isn't working" message.我想使用.htaccess将注册页面重定向到主页,现在我的代码重定向到服务器上的某个奇怪位置并显示“页面无法正常工作”消息。 However I would like it to redirect to homepage.但是我希望它重定向到主页。 How it is possible and what I need to edit?这怎么可能以及我需要编辑什么? I guess index.php ?我猜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.

You are getting Page isn't working error message because your rule redirects /index.php back to itself .您收到Page is not working错误消息,因为您的规则将/index.php重定向回自身。 Your catch-all regex pattern ^(.*)$ also matches the destination URI /index.php .您的所有正则表达式模式^(.*)$也匹配目标 URI /index.php You need to fix it so that the Rule's pattern can not match the destination path.您需要修复它,以便规则的模式无法匹配目标路径。

You can either use a RewriteCond or change your regex to ((?!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