【发布时间】:2016-08-30 03:31:18
【问题描述】:
如何判断http://ttt.com或http://www.ttt.com是否被用户使用,重定向到https://www.ttt.com?
httpd.conf:
<VirtualHost *:80>
ServerName www.ttt.com
ServerAlias ttt.com
DocumentRoot /home/www/html/ttt/public
<Directory /home/www/html/ttt/public>
#Options ExecCGI
#AddDefaultCharset utf-8
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
.htaccess:
RewriteEngine On
############################################
## always send 404 on missing files in these folders
#RewriteCond %{REQUEST_URI} !^/(files)/
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
【问题讨论】:
-
不重复。 Zend Framework 2 已经用过了,你引用的那个不行(已经试过了)
-
@YumYumYum:您能澄清一下starkeen 建议的答案有什么问题吗?
-
paste.fedoraproject.org/362573/23763341 - 当我将 Zend Framework 2 与 .htaccess 一起使用时出现此错误
-
@starkeen:请注意它不是同一个问题。我在使用 Zend 框架的不同环境中,它已经有自己的 .htaccess 要求。从“此处链接”查看正在运行的配置
-
@YumYumYum 接受的答案与重复问题的其他答案相同。你还认为这不是..?
标签: apache .htaccess zend-framework2 centos httpd.conf