Question

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

Posted October 30, 2016 1.5k views
PHP

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]
</IfModule>
edited by asb
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”?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.
Submit an Answer