I authored an easy mod_rewrite to transform my ugly URLs:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule news\/([^\/]+)/([0-9]+)-([^\/]+)$     news.php?id=$2
  RewriteRule (.*)/images/(.*)$                     images/$2
  RewriteRule (.*)/css/(.*)$                            css/$2
  RewriteRule (.*)/js/(.*)$                         js/$2
</IfModule>

An issue immediately came about because all images, scripts, and designs are asked for in accordance with the fake URL. And So I needed to append the following 3 end-of-line assertion for that regex and add the following 3 rules. Things I am asking is the fact that whether this method is nice or perhaps is it consuming an excessive amount of assets? I understand that this is often solved via absolute links but my idleness motivated me to do this solution with a site-wide effect. Or it is possible to better solution?

One factor which was recommended was prepending slashes towards the links. However , the website could be utilized via two domain names: foo.com and bar.com/baz/qux/ and so i really can't use that.

Any help could be appreciated. Thanks!

You might give a <base href=""/> for your html files, which helps you save the picturesOrcascading stylesheetOrjs rewrite rules.

About "consuming an excessive amount of assets" - when you are getting really really many accesses, it'll fall in your ft without a doubt. However I doubt that you will enter into that traffic region.