Re: htaccess question
| From: | Daniel Brown | Date: | Tue, 09 Apr 2013 18:21:07 +0000 |
| Subject: | Re: htaccess question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320804@lists.php.net to get a copy of this message | ||
On Tue, Apr 9, 2013 at 2:07 PM, Al <news@ridersite.org> wrote:
> I know it's not a php question, but I can't readily find the answer
> elsewhere.
>
> I want to make this directive universal. Put htaccess file on any host in
> any folder.
>
> This works
> RewriteEngine On
>
> RewriteCond %{SERVER_PORT} !=443
>
> RewriteRule ^(.*)$ https://www.foo.org/bar/$1 [R=301,L] #Here
> the foo.org
> and /bar must be specified
>
> I want what is in effect
>
> RewriteRule ^(.*)$ https://{host_name}/{directory}/$1 [R=301,L]
>
> I can easily do this with php regex capturing the (host and dir) and then
> rewriting the text string; but the Apache directives are not obvious.
You were on the right track:
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/