2

i have 2 directories in cpanel public_html folder, one for front (www?.domain.xyz) and the other one for admin section (admin.domain.xyz). What should the .htaccess rewrites look like. I tried the following but it only works for front.

DirectoryIndex front/public/index.php RewriteRule ^(.*)$ front/public/$1 [L] 
2
  • Do you want to rewrite subdomain to /subdomain folder? Commented Aug 27, 2017 at 8:34
  • i want to map with www or without www to front directory and admin to admin directory Commented Aug 27, 2017 at 16:14

1 Answer 1

2

To map example.com or www.example.com to /front and sub.example.com to /subdomain folder, you can use these rules :

RewriteEngine on #rewrite main domain to /front folder RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ RewriteRule !front /front%{REQUEST_URI} [NC,L] #subdomain to /subdomain folder RewriteCond %{HTTP_HOST} ^sub\.example\.com$ RewriteRule !subdomainfolder /subdomainfolder%{REQUEST_URI} [NC,L] 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.