Can I use mod rewrite for my new website?

Hi bit of a newbie question.

I have been developing a wordpress site on a test domain for example I now want to point my real domain for example to this site which is straightfoward enough to do. But what do I do about the URLs, images etc that have the test domain within the code?

Is this where mod rewrite comes in helpful?

thanks in advance

No the function of mod_rewrite is to take an incoming URL and rewrite it to another URL to use internally, and it only works on URLs; it will not rewrite code. I’m afraid what you need to do is actually rewrite your code to point to the correct locations, which should be easy enough with a search/replace.


As Rémon pointed out, you have a misconception about what mod_rewrite so I’ll first advise you to read the long tutorial article linked in my signature.

Then, because of the way WP works, I’d advise you to move the installation to the DocumentRoot of your website and adjust the config files to reflect the new locations. Twisting WP around with mod_rewrite (then expecting WP’s mod_rewrite to work) is a hit-and-miss (mostly MISS) situation.