[英]Zend Framework issue with Local instance of Site
I've little to no experience working with Zend Framework 1
. 我几乎没有使用
Zend Framework 1
经验。 Recently I was asked to make some changes to a sites functionality. 最近,有人要求我对网站功能进行一些更改。 So I decided that I would set up a local instance of the site to work on before deploying the changes to the live site.
因此,我决定在将更改部署到实时站点之前,先设置一个站点的本地实例进行处理。
The problem I am having is that when I go to the following url
which is my local instance of the site: http://mysite.tld I am redirected to https://mysite.ie and I cannot figure out why. 我遇到的问题是,当我转到以下
url
这是该站点的本地实例)时: http://mysite.tld我被重定向到https://mysite.ie ,但我不知道为什么。
Is it something to do with the htaccess
file? 与
htaccess
文件有关吗? because I removed the contents of this file in order to see if it had any impact and no joy. 因为我删除了此文件的内容,以便查看它是否有影响并且没有乐趣。
Which made me thing that perhaps in Zend
there is some setting which controls the environment
? 是什么让我觉得,也许
Zend
有一些设置可以控制environment
?
This is my vhosts
file on WAMP: 这是我在WAMP上的
vhosts
文件:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:\wamp\www\mysite.tld\public
ServerName mysite.tld
ErrorLog "logs/mysite.tld"
CustomLog "logs/mysite.tld" common
<directory "C:\wamp\www\mysite.tld\public">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
Allow from 127.0.0.1
</directory>
</VirtualHost>
This is my htaccess
file 这是我的
htaccess
文件
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.mysite.tld/$1 [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.mysite\.tld$ [NC]
RewriteRule ^(.*)$ https://www.mysite.tld/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
If you require any more details from the project I can post them here, I'd appreciate any help as I am at a loss as to whats going on. 如果您需要该项目的更多详细信息,我可以在此处发布它们,感谢您的帮助,因为我对正在发生的事情不知所措。
The following rule performs the redirect from http
to https
equivalent 以下规则执行从
http
到https
的重定向
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.mysite.tld/$1 [L,R=301]
This one redirects to www.mysite.tld
if domain name is not already that one 如果域名还不是该域名,则该域名将重定向到
www.mysite.tld
RewriteCond %{HTTP_HOST} !^www\.mysite\.tld$ [NC]
RewriteRule ^(.*)$ https://www.mysite.tld/$1 [L,R=301]
If you're running it locally, you should comment those 4 lines of code. 如果在本地运行,则应注释这4行代码。
Then , you have to clear your browser's cache to see it working (because your old rules are now in cache). 然后 ,您必须清除浏览器的缓存才能看到它的正常运行(因为您的旧规则现在已在缓存中)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.