Re: Trying to Rewrite Subdomain

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

 



>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@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux