将网站重定向到特定文件夹,然后https

时间:2012-04-19 18:58:34

标签: php regex .htaccess mod-rewrite

我已在安全的https文件夹中创建了一个新版网站,我希望有任何请求转到该文件夹​​,因此例如https://photofileltd.co.uk/index.php?page=services会显示https://secure.photofileltd.co.uk/new_site/index.php?page=services

我在.htaccess尝试了这个,它重新指向正常,但不会更改/屏蔽网址,更新感谢Jan

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://secure.photofileltd.co.uk/new_site/$1 [L]

任何帮助或建议都会非常感激 - 我对htaccess / mod_rewrite一点都不熟悉,谢谢!

2 个答案:

答案 0 :(得分:2)

您正在丢失查询:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://secure.photofileltd.co.uk/new_site/$1 [L]

答案 1 :(得分:1)

尝试

RewriteRule ^ https://secure.photofileltd.co.uk/new_site%{REQUEST_URI} [R=301,L]