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
  • 761,203
  • 64
  • 569
  • 643
Bernat
  • 1,537
  • 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
  • 761,203
  • 64
  • 569
  • 643
0

Try something like this:

RewriteEngine On
RewriteRule ^$ /subdomain [L]

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

Community
  • 1
  • 1
PiTheNumber
  • 22,828
  • 17
  • 107
  • 180
0

For all files

Options +FollowSymlinks 
RewriteEngine on
RewriteRule ^(.+)$ /subdomain/$1 [NC]
LazyOne
  • 158,824
  • 45
  • 388
  • 391
Oras
  • 1,036
  • 1
  • 12
  • 18