Bernat
Bernat

Reputation: 1556

Rewrite .htaccess to subdirectory

How can I rewrite an URL, so when I type

http://mydomain.com/index.php

is the same as

http://mydomain.com/subdomain/index.php

Upvotes: 2

Views: 714

Answers (3)

anubhava
anubhava

Reputation: 786091

If you just want to handle index.php then following will work:

RewriteEngine On
RewriteRule ^(index\.php|)$ subdomain/$1 [L]

However if you want to redirect every request subdomain folder then following will work:

RewriteEngine On
RewriteRule ^(?!subdomain/).*$ subdomain%{REQUEST_URI} [L,NC]

Upvotes: 1

PiTheNumber
PiTheNumber

Reputation: 23562

Try something like this:

RewriteEngine On
RewriteRule ^$ /subdomain [L]

https://stackoverflow.com/a/1328357/956397

Upvotes: 0

Oras
Oras

Reputation: 1096

For all files

Options +FollowSymlinks 
RewriteEngine on
RewriteRule ^(.+)$ /subdomain/$1 [NC]

Upvotes: 0

Related Questions