Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've a rewrite rule to convert mysite.com/?lang=en to mysite.com/en, but this now gets me into troubles as the referenced files in the .html are relative to parent folder, and now its supossed to be /en/ instead of the root folder, how could I fix it?

PS: I think it has something to do with RewriteCond, but couldn't find the solution yet.

Thanks in advance!

share|improve this question
up vote 0 down vote accepted

You have two solutions:

  1. Write the assets in the source code with relative paths (use ../) instead of absolute paths fromt he root.
  2. Move all the assets in some specific folders, such as images, stylesheets, assets... then use mod_rewrite to rewrite /LANG/folder to folder.
share|improve this answer

Yes, you can use RewriteCond to only do the rewrite for .html files:

RewriteCond %{REQUEST_URI} [.]html$ 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.