社区首页 >问答首页 >htaccess重定向影响Joomla上的管理员页面

htaccess重定向影响Joomla上的管理员页面
EN

Stack Overflow用户
提问于 2017-07-03 16:18:25
回答 1查看 330关注 0票数 0

我有一个任务-所有带有尾部斜杠的页面必须重定向到somestuff.html,所有其他没有尾部斜杠的页面必须重定向到添加尾部斜杠(例如,/mypage必须重定向到/mypage/)。我已经完成了任务,但现在/administrator/ page返回404页。我试图排除/administrator/页面,但它不起作用:

代码语言:javascript
代码运行次数:0
复制
DirectoryIndex index.php
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#this part breaks the admin panel entry

RewriteRule ^([^.]+).html/ http://somedomain.com/$1\.html [R=301,L] 
RewriteCond %{REQUEST_URI}  !\.(php|html?|jpg|gif)$

#trying to exclude administrator page
RewriteCond %{REQUEST_URI} !^/administrator/

RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]

#end of part that breaks the admin panel entry

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] 

谁能告诉我我做错了什么,或者可能提供一些不同的解决方案来完成重定向。谢谢。

EN

回答 1

Stack Overflow用户

发布于 2017-07-04 05:53:37

找到了解决方案:

代码语言:javascript
代码运行次数:0
复制
DirectoryIndex index.php
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+).html/ http://logosstudy.ru/$1\.html [R=301,L]
RewriteCond %{REQUEST_URI} !^/administrator/
RewriteCond %{REQUEST_URI}  !\.(php|html?|jpg|gif)$
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]
RewriteCond %{REQUEST_URI} !^/administrator/
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] 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44890143

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文