Is there a way to prevent mod rewrite from breaking down images , script and links

October 30, 2016 1.4k views

my mod_rewrite looks like this

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|css|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php

RewriteRule ^profile/([A-Za-z0-9-]+) profile.php?u=$1[NC]
1 comment
  • mod_rewrite is very flexible and there isn’t much it can’t handle. Can you clarify what you mean by “breaking down images , script and links”?

1 Answer

Sorry to see that your question hasn’t received an answer yet. Unfortunately, after this much time, it is unlikely that an answer for this specific question will be provided. For people still landing here via search, check out this tutorial. It shows you how to get up and running with mod_rewrite for Apache:

by Mateusz Papiernik
The mod_rewrite module allows us to rewrite URLs in a cleaner fashion, translating human-readable paths into code-friendly query strings or redirecting URLs based on additional conditions. This guide is split into two parts. The first sets up an example website and covers a simple rewrite example. The second part contains two more in-depth examples of commonly-used rewrite rules.
Have another answer? Share your knowledge.