从HTTPS重定向中排除特定的URL [英] Exclude specific URL from HTTPS redirect

查看:220
本文介绍了从HTTPS重定向中排除特定的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下TYPO3 mod-rewrite配置(从无法正常工作的尝试中清除).

I'm using the following TYPO3 mod-rewrite configuration (cleaned from not working attempts).

  • 我想从重定向到https的过程中排除特定的URL.
  • 另外添加一条规则,用于通过https请求将此网址重定向到http.

我的错误案例主要是通过重定向到index.php结束的.有人有主意吗?

My errorcase is mostly to end up by getting redirected to index.php. Has anybody an idea?

<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>

尝试(不起作用):

Action application/x-httpd-php55 /cgi-sys/php55-fcgi-starter.fcgi
AddType application/x-httpd-php55 .php .php55

php_flag use_trans_sid Off
php_value date.timezone "Europe/Berlin"
php_value max_execution_time 600
php_value memory_limit 1024M


<FilesMatch "\.(js|css)$">
  <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault "access plus 7 days"
  </IfModule>
  FileETag MTime Size
</FilesMatch>

<IfModule mod_rewrite.c>
    RewriteEngine On

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

    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^(www\.)?domain\.de [NC]
    RewriteCond %{REQUEST_URI} !^/this_uri [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>

推荐答案

问题是,下面的RewriteRule到index.php.每次通过http请求将index.php重定向到https时. 用下面的代码行可以解决问题.

The problem was, the following RewriteRule to index.php. The index.php was getting redirected to https each time it was requested via http. With the following line could solve the problem.

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

这篇关于从HTTPS重定向中排除特定的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆