Server Fault is a question and answer site for system and network administrators. 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

Does Apache rewrite rule automatically change the URL of all pages without editing links?

I tried rewriting Apache rule from .htaccess, but nothing happened, so I'm wondering if I need to edit the links.

share|improve this question

The rewrite rule is generally used to rewrite request headers, and to forward requests to other back-end servers based on patterns and regular expressions, and is not (I don't think it can be, but its kind if super powerful, so who knows... ;-) used to rewrite the body content.

You can think of mod_rewrite as a tool to map the external string onto some internal file /var/www/html or virtual location server-status (or proxied external location, http://tomcat:8080) etc

If you want to rewrite links and HTML strings in the body text there is a apache module called mod_substitute which is useful for that. If you have an old apache, there are other mod_replace and mod_perl/

If you want to replace, delete or modify headers or cookies, mod_headers is a good place to look.

(However there is some cross over between these various modules, so its likely you you would want to be more clear about your requirements in order to get a better answer)

share|improve this answer

Perhaps you forgot to include the all-important RewriteEngine On

mod_rewrite won't change links inside the page. mod_substitute will... but you better make sure the content doesn't get compressed, as mod_substitute doesn't know to decompress it (you could use mod_header to remove any Accept-Encoding request header perhaps). I never had particularly good experiences with mod_substitute.

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.