: 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:
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!
More posts by @Harper822
2 Comments
Sorted by latest first Latest Oldest Best
Untested... but should work
#Options +FollowSymLinks
Options +SymlinksIfOwnerMatch
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cp.example.net$
RewriteRule ^(.*)$ example.net/gamepanel/public/ [R=301,L]
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>
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.