Peter Fox
Peter Fox

Reputation: 1315

.htaccess and rewrite sub domains

I have a website that runs on a custom framework. However i would like to add a gateway subdomain to handle specific requests. As well as a api subdomain to handle api requests.

Now is have a complex folder structure:

-application
-config
-subs (subdomain folder)
  - gateway
  - api
-library
-public
  .htaccess [2]
-scripts
-tmp
.htaccess [1]

Now i would like to get the http://gateway.example.com to redirect to subs > gateway and the http://api.example.com to subs > api folders.

The first .htaccess [1]

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/scripts/
    RewriteRule ^(.*)$ /public/$1 [L]
 </IfModule>

The second .htaccess [2] (i don't think this needed to post here, but you newer know ;)

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^popup/   - [L]
RewriteRule ^img/   - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$              index.php?url=$0 [PT,L]
</IfModule>

I think i should change the first .htaccess [1]. But to what?

Please help me out.

Upvotes: 1

Views: 110

Answers (1)

anubhava
anubhava

Reputation: 785128

This can be fixed by setting up your VirtulDomain correctly like this for gateway sub domain:

DocumentRoot /home/example/domains/example.com/public_html/subs/gateway

Upvotes: 1

Related Questions