1

/checkoutという特定のサブフォルダーにmodre-writeしようとしていますが、これにはhttps用のSSL証明書が添付されています

だから私は私のサイトのルートフォルダにこれを持っています-

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

# in http: force secure.html to https
RewriteCond %{server_port} !=443
RewriteCond $1 ^([^/]+)$ [NC]
# this kinda works below but is resolving to index2.php and is showing in the url so not really working yet
RewriteRule checkout/([^/]+)\.html$ https://mysite.com/checkout/index2.php [L] 

それを除いて

https://mysite.com/checkout/index.html

それが示している

https://mysite.com/checkout/index2.php

(index2.phpはテストURLです)

また、サブフォルダの.htaccessを次のように修正してみました

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteCond %{server_port} !=443
RewriteCond $1 ^([^/]+)$ [NC]
RewriteRule ^([^/\.]+)/?$ https://mysite.com/checkout/index2.php [L]

処理したいだけです

https://mysite.com/checkout/index.htmlまたはhttps://mysite.com/checkout/about-us.html同じように私はこのようにルートにいます https://mysite.com/index.html=> https://mysite.com/index.php(そして変数などを取得します)

すなわち

 RewriteRule ^/?(catalogue-page)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+) index2.php?friendly_url=$1&catalogue_id=$2&view=catalogue&categoryid=$3&subcategoryid=$4&subjectid=$5&item=$6

httpsはもっと複雑だと思います。ポインタ/ヘルプなどは大歓迎です

4

1 に答える 1

1

RewriteRuleは、セキュリティで保護されていないURLを取得し、https経由で別のページを表示しようとしていることを示しているようですが、これ自体は不可能です。あなたの説明がそのように聞こえないと言ったのは、全体的な目的です。

安全でないURLを強制的に安全にしたい場合は、これで問題ありません。また、サーバーindex.phpへのindex.htmlのリクエストも問題ありません。ただし、これをすべて一挙に行うことはできません。

# first force urls to be secure.
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^checkout/([^/\.]+)/?$ https://mysite.com/%{REQUEST_URI} [R=301,L]

# now rewrite them, so that the requests all get served through the front controller
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^checkout/([^/\.]+)/?$ /checkout/index2.php [L]
于 2012-10-01T21:44:00.797 に答える