我有一个Magento的网站,我需要把它重定向到https,我已经安装了证书,但我不知道如何modhtaccess的文件吗? 这里是根htaccess文件的副本 谢谢
###################################### #####
##注释这些行的CGI模式
##请务必指定正确的cgi php的二进制文件名
##它可能是/ cgi-bin目录/ PHP-CGI
#操作PHP5,CGI / cgi-bin目录/ PHP5,CGI
#AddHandler的PHP5,CGI的.php
############################################
## GoDaddy的特定选项
#选项-MultiViews
##,你可能还需要加入这行为php.ini
## cgi.fix_pathinfo = 1
##,如果它仍然无法正常工作,重命名php.ini中php5.ini
############################################
##这条线是具体的的1and1主机
#AddType的X MAPP-PHP5的.php
#AddHandler的X MAPP-PHP5的.php
############################################
##默认的索引文件
的DirectoryIndex index.php文件
< IfModule mod_php5.c>
############################################
##调整内存限制
#php_value memory_limit的64M
php_value memory_limit的128M
php_value max_execution_time仅仅18000
############################################
##禁用魔术引号PHP请求瓦尔
的php_flag magic_quotes_gpc的关
############################################
##禁用自动会话启动
##自动加载之前初始化
的php_flag session.auto_start关闭
############################################
##让产生的HTML COM pression
#php_flag zlib.output_com pression上
###########################################
#禁止用户代理验证,不破多图片上传
的php_flag suhosin.session.cryptua关闭
###########################################
#关闭与PHP4的兼容性在与对象打交道
的php_flag zend.ze1_compatibility_mode关闭
< / IfModule>
< IfModule mod_security.c>
###########################################
#禁止后处理,以不破多图片上传
SecFilterEngine关闭
SecFilterScanPOST关闭
< / IfModule>
< IfModule mod_deflate.c>
############################################
#将过滤器上的所有内容
### SetOutputFilter DEFLATE
所选内容类型#将过滤器只
#AddOutputFilterByType DEFLATE text / html的文本/纯文本/ XML文本/ CSS文/ JavaScript的
#Netscape 4.x版本有一些问题...
#BrowserMatch ^的Mozilla / 4 GZIP只-text / html的
#网景4.06-4.08有一些更多的问题
#BrowserMatch ^的Mozilla / 4 .0 [678]无GZIP
#MSIE伪装成Netscape的,但它是精细
#BrowserMatch bMSIE!没有GZIP!GZIP只-text / html的
#不要COM preSS图片
#SetEnvIfNoCase REQUEST_URI 。(?: GIF |?JPE G | PNG)$无gzip的不要,各不相同
#请确保代理不提供错误的内容
的#header追加的Vary的用户代理包膜=!不,变化
< / IfModule>
< IfModule mod_ssl.c>
############################################
##进行HTTPS ENV瓦尔可用于CGI模式
SSLOptions StdEnvVars
< / IfModule>
< IfModule mod_rewrite.c>
############################################
##启用重写
选项+的FollowSymLinks
RewriteEngine叙述上
############################################
##,你可以把这里你的Magento的根文件夹
相对于Web根##路
#RewriteBase / Magento的/
############################################
##解决方法HTTP授权
##在CGI环境
。重写规则* - [E = HTTP_AUTHORIZATION:%{HTTP:授权}]
############################################
##总是在这些文件夹丢失的文件发送404
的RewriteCond%{REQUEST_URI} ^ /!(媒体|皮肤| JS)/
############################################
##从来不重写现有的文件,目录和链接
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{} REQUEST_FILENAME!-l
############################################
##改写一切的index.php
重写规则。*的index.php [L]
< / IfModule>
############################################
##从服务器覆盖prevent字符编码问题
##如果你还有问题,可以使用第二行,而不是
AddDefaultCharset关闭
#AddDefaultCharset UTF-8
< IfModule mod_expires.c>
############################################
小号
ExpiresDefault进入加1年
< / IfModule>
############################################
##在默认情况下允许所有访问
订购允许,拒绝
所有允许
解决方案
RewriteEngine叙述上
的RewriteCond%{} SERVER_PORT 80
(。*)重写规则^ $的https://%{HTTP_HOST} / $ 1 [R,L]
测试及工作!这是我使用...
I have a magento site and i need to have it redirect to https, i have the cert installed but i am not sure how to mod the htaccess file? here is a copy of the root htaccess file thanks
###########################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi
# Action php5-cgi /cgi-bin/php5-cgi
# AddHandler php5-cgi .php
############################################
## GoDaddy specific options
# Options -MultiViews
## you might also need to add this line to php.ini
## cgi.fix_pathinfo = 1
## if it still doesn't work, rename php.ini to php5.ini
############################################
## this line is specific for 1and1 hosting
#AddType x-mapp-php5 .php
#AddHandler x-mapp-php5 .php
############################################
## default index file
DirectoryIndex index.php
<IfModule mod_php5.c>
############################################
## adjust memory limit
# php_value memory_limit 64M
php_value memory_limit 128M
php_value max_execution_time 18000
############################################
## disable magic quotes for php request vars
php_flag magic_quotes_gpc off
############################################
## disable automatic session start
## before autoload was initialized
php_flag session.auto_start off
############################################
## enable resulting html compression
#php_flag zlib.output_compression on
###########################################
# disable user agent verification to not break multiple image upload
php_flag suhosin.session.cryptua off
###########################################
# turn off compatibility with PHP4 when dealing with objects
php_flag zend.ze1_compatibility_mode Off
</IfModule>
<IfModule mod_security.c>
###########################################
# disable POST processing to not break multiple image upload
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
<IfModule mod_deflate.c>
############################################
# Insert filter on all content
###SetOutputFilter DEFLATE
# Insert filter on selected content types only
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
# Netscape 4.x has some problems...
#BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
#BrowserMatch ^Mozilla/4.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
#BrowserMatch bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
#SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
#Header append Vary User-Agent env=!dont-vary
</IfModule>
<IfModule mod_ssl.c>
############################################
## make HTTPS env vars available for CGI mode
SSLOptions StdEnvVars
</IfModule>
<IfModule mod_rewrite.c>
############################################
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
############################################
## you can put here your magento root folder
## path relative to web root
#RewriteBase /magento/
############################################
## workaround for HTTP authorization
## in CGI environment
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
############################################
## always send 404 on missing files in these folders
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
############################################
## never rewrite for existing files, directories and links
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
############################################
## rewrite everything else to index.php
RewriteRule .* index.php [L]
</IfModule>
############################################
## Prevent character encoding issues from server overrides
## If you still have problems, use the second line instead
AddDefaultCharset Off
#AddDefaultCharset UTF-8
<IfModule mod_expires.c>
############################################
s
ExpiresDefault "access plus 1 year"
</IfModule>
############################################
## By default allow all access
Order allow,deny
Allow from all
解决方案
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]
Tested and working! This is what i use...