Apache 从HTTPS重定向中排除特定URL

Apache 从HTTPS重定向中排除特定URL,apache,.htaccess,mod-rewrite,https,typo3,Apache,.htaccess,Mod Rewrite,Https,Typo3,我正在使用下面的TYPO3 mod rewrite配置(从无效尝试中清除) 我想将特定URL从重定向到https中排除 另外,如果通过https请求,请添加将此url重定向到http的规则 我的错误案例主要是通过重定向到index.php来结束。有人有主意吗 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^(www\

我正在使用下面的TYPO3 mod rewrite配置(从无效尝试中清除)

  • 我想将特定URL从重定向到https中排除
  • 另外,如果通过https请求,请添加将此url重定向到http的规则
我的错误案例主要是通过重定向到index.php来结束。有人有主意吗

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^(www\.)?domain\.de [NC]
    RewriteRule ^/?(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]

    RewriteRule ^fileadmin/(.*/)?_recycler_/ - [F]
    RewriteRule ^fileadmin/templates/.*(\.txt|\.ts)$ - [F]
    RewriteRule ^typo3conf/ext/[^/]+/Resources/Private/ - [F]

    RewriteRule ^(typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

    RewriteRule .* index.php [L]
</IfModule>

重新启动发动机
重写cond%{HTTPS}=在…上
重写cond%{HTTP_HOST}^(www\)?域\.de[NC]
重写规则^/?(*)https://%{HTTP_HOST}%{REQUEST_URI}[R,L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(+)\(\d+)\(php | js | css | png | jpg | gif | gzip)$$1.$3[L]
重写规则^fileadmin/(.*/)?\u回收商\u/-[F]
重写规则^fileadmin/templates/*(\.txt\.ts)$-[F]
重写规则^typo3conf/ext/[^/]+/Resources/Private/-[F]
重写规则^(typo3/| fileadmin/| typo3conf/| typo3temp/| uploads/| favicon\.ico)-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-L
重写规则。*index.php[L]
尝试(不工作):

Action应用程序/x-httpd-php55/cgi sys/php55-fcgi-starter.fcgi
AddType应用程序/x-httpd-php55.php.php55
php_标志使用_trans_sid关闭
php_value date.timezone“欧洲/柏林”
php_值最大执行时间600
php_值内存_限制1024M
过期于
ExpiresDefault“访问加7天”
FileTag MTime大小
重新启动发动机
在上重写cond%{HTTPS}
RewriteCond%{REQUEST_URI}^/此_URI[NC]
重写规则^http://%{http_HOST}%{REQUEST_URI}[NC,L,R]
重写cond%{HTTPS}=在…上
重写cond%{HTTP_HOST}^(www\)?域\.de[NC]
重写cond%{REQUEST_URI}^/这是[NC]
重写规则^/?(*)https://%{HTTP_HOST}%{REQUEST_URI}[R,L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(+)\(\d+)\(php | js | css | png | jpg | gif | gzip)$$1.$3[L]
重写规则^fileadmin/(.*/)?\u回收商\u/-[F]
重写规则^fileadmin/templates/*(\.txt\.ts)$-[F]
重写规则^typo3conf/ext/[^/]+/Resources/Private/-[F]
重写规则^(typo3/| fileadmin/| typo3conf/| typo3temp/| uploads/| favicon\.ico)-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-L
重写规则。*index.php[L]

要从https重定向中排除spacific uri,只需在https重定向规则上方添加以下行:

RewriteCond %{REQUEST_URI} !^/this_uri [NC]
要将此_uri从https重定向到http,请执行以下操作:

在htaccess中输入以下两行引擎指令:

RewriteCond %{HTTPS} on

RewriteCond %{REQUEST_URI} ^/this_uri [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [NC,L,R]

问题是,将以下规则重写为index.php。每次通过http请求index.php时,它都会被重定向到https。 使用以下行可以解决问题

RewriteCond %{REQUEST_URI} !^/index.php [NC]

我也遇到了同样的情况,挣扎了4个小时,终于得到了我的特定url重定向到http

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{THE_REQUEST} !/(home/panel/videos|user/profile) [NC] # Multiple urls
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTPS} on
RewriteCond %{THE_REQUEST} /(home/panel/videos|user/profile) [NC] # Multiple urls
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

它对我起了作用:)

不幸的是,同样的问题<代码>https://www.domain.de/this_uri不会被重定向,并且
http://www.domain.de/this_uri
正在被重定向到
https://www.domain.de/index.php
您可以发布当前的htaccess文件吗?模式和目标之间应该有一个空格^http检查您的第一条规则。那是错别字吗?好的,错别字。但是现在这个uri的https和http都重定向到index.phpWhere我把这行放在哪里?
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{THE_REQUEST} !/(home/panel/videos|user/profile) [NC] # Multiple urls
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTPS} on
RewriteCond %{THE_REQUEST} /(home/panel/videos|user/profile) [NC] # Multiple urls
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]