I'm an apache newbie who has finally got a rewrite rule working, namely: RewriteRule (.*)$ index.php?FixedTitle=$1 The problem is, it's working too well because it's rewriting literally everything, including my image files. How can I alter the above rule so that it will only affect URLs of the following form, which, as you see, have no extensions: mydomain.com/ARTICLE_NAME1 mydomain.com/ARITCLE_NAME2 The above are the only files that I want rewritten by the rule. (I don't want files ending in .html .jpg .php (etc.) to be rewritten too.) Any ideas on what change I need to make in the rewrite rule? Thanks! Brian
Thanks very much for the answer, Seismic -- I'm afraid that I didn't explain the problem clearly enough, however. I should have taken a little more time on my description. In reality, there are no files involved that actually have the names ARTICLE_NAME1, ARTICLE_NAME2, and so forth. That was just my confusing way of saying that I have a long list of article names. In other words, the actual addresses that I DO want to rewrite look like this: The-Big-Box War-of-the-Worlds Now-Hear-This and so forth. The only thing these addresses have in common is that they have no file extensions, as opposed to the file names that I DON'T want to rewrite, which end in .html, .php, jpg, gif, and so forth. My question is, how to rewrite my extension-free addresses without also rewriting the file names WITH extensions. Any ideas, now that I (hopefully) have stated the case more clearly?
What you want is a RewriteCond. RewriteCond %{REQUEST_URI} !(\.jpg|\.html|\.php) RewriteRule (.*)$ index.php?FixedTitle=$1 Code (markup): What this does is applies the condition in the RewriteCond before the rewrite rule. The RewriteRule is only executed if the RewriteCond matches. So, the URL has to not have ".jpg" or ".html" or ".php" in it for the RewriteRule to be executed. If you only want to avoid rewriting URLs that end in these extensions then you can use this one instead: RewriteCond %{REQUEST_URI} !(\.jpg|\.html|\.php)$ RewriteRule (.*)$ index.php?FixedTitle=$1 Code (markup):