Home Redirecting subdomain without changing URL using .htaccess
Reply: 1

Redirecting subdomain without changing URL using .htaccess

alanj1998 Published in 2017-12-02 22:23:36Z

wondering if you can help me with some .htaccess.

I want to have sub.example.com display data from example.com/sub without changing the URL : ie. sub.example.com will stay sub.example.com although it is reading from example.com/sub

I have the following data in .htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.example.com
RewriteRule ^(.*)$  http://example.com/sub/$1 [L,NC,QSA]

I tried to change the [L,NC,QSA] to [P] but I get an error 403 - forbidden access.

Any help would be appreciated!

Trueman Reply to 2017-12-02 22:28:45Z
RewriteCond %{HTTP_HOST} ^sub.example.com [NC]
RewriteRule ^(.*)$ http://example.com/sub/$1 [L,R=301]
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.311299 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO