htaccess Tester

URL
 
htaccess Rules
Powered by madewithlove.be
   https://www.domain.com/folder/index.html

Debugging

Line Valid Reached Met
RewriteEngine on
RewriteEngine was now turned on for the document.
RewriteCond %{HTTPS} off
This condition was met.
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=302,L]
The new url is https://www.domain.com/folder/index.html Test are stopped, a redirect will be made with status code 302
RewriteCond %{HTTP_HOST} ^www\.(.*)
This condition was not met.
RewriteRule ^(.*)$ https://%1/$1 [R=302,L]
This rule was not met.
RewriteRule ^folder\/ alternative/
This rule was not met.

Test Your .HTACCESS File

Built using the api kindly provided by the nice people at madewithlove.be, this tool allows you to test whether your .htaccess file redirects the url's as you expect them to.

Simply enter a url and some htaccess rules and the 'Test' button will be activated. If appropriate, you can include the optional Referrer and/or Server Name fields. The resultant URL will appear right here after you click the button.

The Redirect Button

This feature allows you to simulate what happens when a url redirect occurs. The new url is passed through the .htaccess rules to check if the new url is changed further. It is not good practise for a url to be redirected more than once; if this is the case, you should rewrite the rules so all permutations of url are redirected to their correct destination in a single pass.

Here are a couple of examples:

  • A bad example. This url will reach it's final destination after 3 redirects.
  • A good example.The same url reaches it's final destination in a single pass. Try both examples with the following url's:
    • https://www.domain.com/folder.index.html
    • http://www.domain.com/alternative/index.html
    • http://domain.com/folder/index.html
    • http://domain.com/alternative/index.html

The Share Button

Want to save your htaccess file so you can come back and work on it later, or share your work of art (science?) with others? Clicking the share button will generate a link (and copy it to your clipboard), so you can come back to it at a later date.

Want some help with your .htaccess rules?

Visit the article that precipitated my creating this little app: https://thecuriouswebsitedesigner.co.uk/htaccess-a-guide-to-rewrite-rules.