Apache rewrite rules are very powerful to rewrite URLs of a website by using the .htccess file. Unfortunately there is no way to debug these rulesif you don't have any access to the Apache installation. That's a common issue of users of managed servers. YOu have to execute a trial and error cycle in order to get your rules right. If you follow some rules you will be successfull to create your rules and don't affect any visitors of your website.


First of all you have to be familiar with regular expressions to create the rules and to iterate them with tests. See links below.

1) Use 302 to test your rules

301 are cached by browsers which creates serious problems for your visitors and for you when you're testing your rules. In addition don't change to 301 when you think your rules are OK. Just wait for some period of time until switching to 302. Otherwise visitors of your wbesite will get 404 even you fixed an incorrect rule in the meantime.

2) Use a special user agent for your tests

That way it's only you who will be redirected but no other website visitor will be affected by your tests.

RewriteCond %{HTTP_USER_AGENT}  ^my-test-user-agent$
RewriteCond %{HTTP_HOST} ^www\.myWebsite\.de$ [NC]
RewriteRule ^ http://www.google.de [L,R=302]

3) Use wget in order to bypass any caching and use the special test user agent

wget -U "my-test-user-agent" http://www.myWebsitede


Useful links


Online Regex Tester

Ein weiterer Online Regex Tester

Noch ein Online Regex Tester

rewrite online Tester

Apache URL rewriting guide

Regular expression info

Regex Tutorial

Add comment

Spam Kommentare sind sinnlos !
Vor der Publizierung wird jeder Beitrag auf Spam geprüft. Leider dauert es deswegen bis ein Kommentar sichtbar wird. Dafür erhält aber kein Subscriber Spam eMails.
Die eMail ist optional und nicht öffentlich sichtbar. Sie ist notwendig um eMail Benachrichtigungen zu Antworten auf Kommentare zu erhalten. Sie wird auch u.U. auch vom Seitenbetreiber genutzt um offline Kontakt aufzunehmen.

Spam comments are useless !
Any comment will be reviewed first and checked for spam. Unfortunately this delays the publishing of comments but will protect subscribers from spam.
eMail is optional and hidden and is required to get update notifications for any comments. In addition your eMail may be used by the website owner to get in contact with you offline.