Re: htaccess question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 9, 2013 at 2:07 PM, Al <news@xxxxxxxxxxxxx> 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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux