httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Arnold <carn...@electrichendrix.com>
Subject Re: [users@httpd] Trying to Rewrite Subdomain
Date Sun, 07 Apr 2013 00:39:06 GMT
>Apache 2.2.12. I am trying to rewrite a subdomain like so:
>http://sub.domain.com to http://sub.domain.com/"alias".
>Here is the alias conf:
>
>Alias /"alias" /path/to/root/directory
><Directory /path/to/root/directory>
>    Options FollowSymLinks
>    AllowOverride None
>    Order allow,deny
>    allow from all
>    DirectoryIndex index.php
>    php_admin_flag magic_quotes_gpc Off
></Directory>
>
>I made a virtualhost file in vhost.conf directory like so:
>
><VirtualHost *:80>
>    ServerName sub.domain.com
>
>    RewriteCond %{HTTP_HOST} ^sub.domain.com [NC]
>    RewriteCond %{REQUEST_URI} !^/"alias"/
>   RewriteRule ^(.*) http://sub.domain.com/"alias"/ [L]
>
></VirtualHost>
>
>When going to http://sub.domain.com, i get a 403:
>[Sat Apr 06 18:44:34 2013] [error] [client ip] Directory index forbidden by Options directive:
/srv/www/htdocs/
>
>First, are the rewrite rules correct for what i am trying to do? Second, should they be
included in the "alias" file >to work?

I got this to work  by putting a redirectmatch in the alias file, like so:
ServerName sub.domain.com

    RedirectMatch ^/$ http://sub.domain.com/alias/

Alias /alias /path/to/root/directory
<Directory /path/to/root/directory>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    allow from all
    DirectoryIndex index.php
    php_admin_flag magic_quotes_gpc Off
</Directory>

Is there a way to configure this to answer for any domain? The apps. part will always stay
the same but the domain part will change. A wildcard of sorts. So, http://apps.domain1.tld,
http://apps.domain2.tld and so on; this conf file would answer for any http://apps.domain.tld
request.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message