2

Hello in my htaccesss file i put this code to ensure that my directory index file is set to

v2013/index.html

so i put this code

DirectoryIndex v2013/index.html

Then i Want it to look like mydomain.com/Welcome, so i add..

RewriteEngine On
RewriteRule ^Welcome$ v2013/index.html [L]

My question is why DirectoryIndex not working anymore.. and how can i tell the browser to look for the css inside v2013, because is looking in the root. ( i think because of rewrite) SO MY PAGE IS UNSTYLE.. =(

In other words is looking for www.domain.com/css/sheet.css insted of

www.domain.com/v2013/css/sheet.css

THE ANSWER HERE:

FINAL CODE

DirectoryIndex v2013/index.html

RewriteEngine On

# exclude files already asking for v2013
RewriteCond %{REQUEST_URI} !^/v2013/
RewriteRule ^css/.*$ /v2013/$0
RewriteRule ^js/.*$ /v2013/$0
RewriteRule ^images/.*$ /v2013/$0

RewriteRule ^Bienvenido$ v2013/index.html [L]
Monclee
  • 146
  • 11

2 Answers2

1

You can add an additional RewriteRule, which rewrites the css/, js/ and images/ files as well

# exclude files already asking for v2013
RewriteCond %{REQUEST_URI} !^/v2013/
RewriteRule ^(?:css|images|js)/.*$ /v2013/$0
Olaf Dietsche
  • 66,104
  • 6
  • 91
  • 177
  • hey thanks!! you almost got it!... but i need the same for calling images . Do i have to do the same for each folder? EDIT (yes it works) – Monclee Mar 22 '13 at 18:33
0

Where you use the css file don't type "css/style.css", write "/css/style.css". Adding a / takes you to the root. The html should look like this:

     <link href="/v2013/css/style.css" rel"stylesheet" type="text/css" />
Chaoz
  • 1,710
  • 1
  • 18
  • 34
  • your maybe missing the point... At this point is looking to www.domain.com/css/sheet.css If i put /css/ is not going to look at www.domain.com/v2013/css/sheet Also if you go to domain.com/v2013/index.html my page its looking great its a problem in htaccess so i can show my page on domain.com/welcome – Monclee Mar 20 '13 at 16:51