Mobile app version of vmapp.org
Login or Join
Harper822

: Using .htaccess to get content from directory for sub-domain I've read a tonne of questions on this and tried a few solutions, but I'm just not getting the results I want. I'm currently using:

@Harper822

Posted in: #Htaccess #Masking #Subdomain #UrlRewriting

I've read a tonne of questions on this and tried a few solutions, but I'm just not getting the results I want.

I'm currently using:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^cp.example.net
RewriteRule ^(.*)$ example.net/gamepanel/public/ [L,NC,QSA]


Which doesn't quite work as intended. When I navigate to cp.example.net I am redirected to example.net/gamepanel/public/
What I want to have happen is for cp.example.net to show the content at example.net/gamepanel/public, whilst showing the subdomain in the URL.

Also cp.example.net/user should show content from example.net/gamepanel/public/user

Some help on achieving this would be much appreciated!

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Harper822

2 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo487

Untested... but should work
#Options +FollowSymLinks
Options +SymlinksIfOwnerMatch

RewriteEngine on
RewriteCond %{HTTP_HOST} ^cp.example.net$
RewriteRule ^(.*)$ example.net/gamepanel/public/ [R=301,L]

10% popularity Vote Up Vote Down


 

@Angela700

After more digging, associating the sub domain with my directory was the better way to do this:

<VirtualHost *:80>
ServerName cp.example.net
DocumentRoot /var/www/gamepanel/public
<Directory /var/www/gamepanel/public>
Options -Indexes
</Directory>
</VirtualHost>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme