htaccess重定向问题多次重定向

时间:2017-11-04 04:42:34

标签: apache .htaccess mod-rewrite

早些时候,我的网站上有http,所以我的htaccess工作正常没有任何问题。 昨天我安装了SSL证书,现在我的网站出现故障并且出现了很多错误。 我在.htaccess文件中进行了更改,因此所有请求都应该是https而不是http。 下面是.htaccess文件。

Options -MultiViews


RewriteEngine On
RewriteBase /

# disable directory browsing
Options -Indexes

RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^ - [L]

#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.xxx[NC]
RewriteRule ^(.*)$ http://www.mydomain.xxx/$1 [L,R=301,NC]

ErrorDocument 404 /404.php

RewriteRule ^sitemap.xml sitemap.php [L]

RewriteRule ^([^/]+)/(\d+)/$ $1/$2 [R=301,L]

RewriteCond %{THE_REQUEST} \s/view_resume\.php\?var1=([0-9]+)\s [NC]
RewriteRule ^ view_resume/%1? [R=301,L]

RewriteCond %{THE_REQUEST} \s/profile_view\.php\?var1=([0-9]+)\s [NC]
RewriteRule ^ profile_view/%1? [R=301,L]

RewriteCond %{THE_REQUEST} \s/view_resume_pdf\.php\?var1=([0-9]+)\s [NC]
RewriteRule ^ view_resume_pdf/%1? [R=301,L]

RewriteCond %{THE_REQUEST} \s/view_emp_profile\.php\?var1=([0-9]+)\s [NC]
RewriteRule ^ view_emp_profile/%1? [R=301,L]

RewriteCond %{THE_REQUEST} \s/view_job\.php\?var1=([0-9]+)\s [NC]
RewriteRule ^ view_job/%1? [R=301,L]

RewriteCond %{THE_REQUEST} \s/job_posting_edit\.php\?var1=([0-9]+)\s [NC]
RewriteRule ^ job_posting_edit/%1? [R=301,L]

RewriteCond %{THE_REQUEST} \s/view_job_response\.php\?var1=([0-9]+)\s [NC]
RewriteRule ^ view_job_response/%1? [R=301,L]


RewriteRule ^view_resume/([0-9]+)$ /view_resume.php?var1=$1 [L]
RewriteRule ^(view_resume)/(\d+)/([^/]+)$ view_resume.php?var1=$2&var2=$3 [NC,L]

RewriteRule ^profile_view/([0-9]+)$ /profile_view.php?var1=$1 [L]
RewriteRule ^(profile_view)/(\d+)/([^/]+)$ profile_view.php?var1=$2&var2=$3 [NC,L]

RewriteRule ^view_resume_pdf/([0-9]+)$ /view_resume_pdf.php?var1=$1 [L]
RewriteRule ^(view_resume_pdf)/(\d+)/([^/]+)$ view_resume_pdf.php?var1=$2&var2=$3 [NC,L]

RewriteRule ^view_emp_profile/([0-9]+)$ /view_emp_profile.php?var1=$1 [L]
RewriteRule ^(view_emp_profile)/(\d+)/([^/]+)$ view_emp_profile.php?var1=$2&var2=$3 [NC,L]

RewriteRule ^job_posting_edit/([0-9]+)$ /job_posting_edit.php?var1=$1 [L]
RewriteRule ^(job_posting_edit)/(\d+)/([^/]+)$ job_posting_edit.php?var1=$2&var2=$3 [NC,L]

RewriteRule ^view_job/([0-9]+)$ /view_job.php?var1=$1 [L]
RewriteRule ^(view_job)/(\d+)/([^/]+)$ view_job.php?var1=$2&var2=$3 [NC,L]

RewriteRule ^view_job_response/([0-9]+)$ /view_job_response.php?var1=$1 [L]
RewriteRule ^(view_job_response)/(\d+)/([^/]+)$ view_job_response.php?var1=$2&var2=$3 [NC,L]

RewriteRule ^activation/([a-zA-Z0-9_-]+)$ activation.php?code=$1
RewriteRule ^activation/([a-zA-Z0-9_-]+)/$ activation.php?code=$1

重定向到https我在.htaccess文件中添加了以下代码。

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]

但它给我的错误就像网站多次重定向

请告知如何解决此问题。

0 个答案:

没有答案