Learn the basics of mod-rewrite | htaccess tutorial step by step for beginners

April 15, 2021 2 Comments

htaccess has always been a confusing topic for all Apache users especially for newbies who are learning to write RewriteRules to modify URLs via an htaccess file. The reason why some people find it confusing is because the Apache mod-rewrite documentation is hard to follow and there are no easy to follow htaccess step by …

How to set an ENV (Environment) variable using RewriteRule in htaccess

March 27, 2021 0 Comments

There are different ways and directives to set an environment variable on Apache server through a htaccess file. One of the most common and the easiest way to set an Environment variable is by using a RewriteRule directive. It’s the easiest method because you can rewrite your domain requests based on env and also you …

http to https and enforce www in one 301 redirect on htaccess

March 23, 2021 0 Comments

If you are looking for an htaccess RewriteRule that enforces www and https in one redirection and without creating multiple redirects then you have come to the right place. On this article I am going post a 100 percent working rule that you can just copy and paste to your htaccess file. Here is the …

Mod-rewrite NE flag uses and code examples

March 22, 2021 0 Comments

In this article we will learn about mod-rewrite NEflag. What this flag is used for and why we should use it all these frequently asked questions are answered in this article. NE stands for NoEscape We use this flag in RewriteRule to tell the engine not to escape special characters like # , & .. …

5 awesome htaccess rules you can just copy and paste

March 21, 2021 0 Comments

In this post you will find 5 mod-rewrite rules that you can just copy and paste to your htaccess file. htaccess copy paste rules with code examples. All the rules provided here are tested and works perfectly fine in an htaccess file. If you are one of those guys who loves to copy and paste …

Mod rewrite QSD flag and its uses in htaccess

March 17, 2021 0 Comments

QSD stands for “Query String Discard” as the name implies this flag is used to discard query string from URLs. This flag is supported on Apache versions 2.4+ . If you use this flag on earlier versions the you will get an “internal server error” as the flag is not defined on earlier versions of …

How to use ErrorDocument directive in htaccess file? Apache URL Rewriting tips

March 16, 2021 0 Comments

ErrorDocument directive ErrorDocument directive is part of Apache core module . To use this directive in htaccess you do not need to do anything . This directive is enabled on Apache server by default. ErrorDocument can be used in htaccess or server.config file on Apache server. We use this to manipulate broken or blocked URLs …

Conditional URL rewriting on Apache server

March 15, 2021 0 Comments

In this post we will learn about conditional URL rewriting on Apache server. This conditional URL rewriting tutorial is for mod rewrite beginners and advanced users who wish to learn how conditions work and how they are applied to RewriteRule . If you follow this short tutorial from top to the bottom then you will …

How to set a different file as directory index using htaccess

January 1, 2021 0 Comments

With htaccess it is quite possible to change the directory index file to any other file. By default a file that contains the index perfix is served as directory index handler by the server. But this behavior can be changed by using a one line of code in htaccess. In this post you will learn …

Remove .html and php extension with htaccess RewriteRule | URL Rewriting Tips

February 4, 2020 0 Comments

Remove php and html file extension from URLs using RewriteRule in htaccess In this post we will learn how to use RewriteRule directive to remove html and php file extensions from URLs. I know there are thousands of similar posts already indexed on the web but this post is unique and helpful to URL Rewriting …