【问题标题】:htaccess redirects affect administrator page on Joomlahtaccess 重定向会影响 Joomla 上的管理员页面
【发布时间】:2017-12-06 23:48:57
【问题描述】:

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

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] 

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

【问题讨论】:

    标签: .htaccess joomla


    【解决方案1】:

    找到解决办法:

    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] 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-26
      • 2011-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-25
      • 2019-07-09
      • 2012-04-10
      相关资源
      最近更新 更多