2

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
anubhava
  • 664,788
  • 59
  • 469
  • 547
Bernat
  • 1,532
  • 3
  • 18
  • 40

3 Answers3

1

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]
anubhava
  • 664,788
  • 59
  • 469
  • 547
0

Try something like this:

RewriteEngine On
RewriteRule ^$ /subdomain [L]

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

Community
  • 1
  • 1
PiTheNumber
  • 20,216
  • 13
  • 96
  • 165
0

For all files

Options +FollowSymlinks 
RewriteEngine on
RewriteRule ^(.+)$ /subdomain/$1 [NC]
LazyOne
  • 137,403
  • 37
  • 338
  • 342
Oras
  • 915
  • 8
  • 15