IMG, JS, CSS and other files failed to load after using RewriteRule in htaccess?

March 30, 2021 0 Comments

Last Updated on April 20, 2021 by amitoverflow1 One of the most common issue every mod-rewrite users encounter while using RewriteRule directive to shorten their URLs is the IMG, CSS , JS and other relative resources failing to load. If you are using RewriteRules to rewrite your URLs then you may sometimes face this kind …

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

March 27, 2021 0 Comments

Last Updated on April 15, 2021 by amitoverflow1 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 …

Redirect a domain to another domain without changing URL with htaccess

March 26, 2021 0 Comments

Last Updated on April 19, 2021 by amitoverflow1 In this post I will show you how to write a rule to redirect your domain to an external domain without changing the URL in browser address bar . Redirect domain without changing the URL . You need to enable proxy module on your apache web server …

Map a subdomain to subfolder with htaccess

March 25, 2021 0 Comments

Last Updated on April 15, 2021 by amitoverflow1 With an htaccess rewrite ,it is quite possible to map your subdomain to subfolder if its not already pointing there. Suppose, you just created a new subdomain named bar.example.com and its currently pointing to you root directory , you can simply use a RewriteRule to map it …

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

March 23, 2021 0 Comments

Last Updated on April 14, 2021 by amitoverflow1 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 …

Mod-rewrite NE flag uses and code examples

March 22, 2021 0 Comments

Last Updated on April 19, 2021 by amitoverflow1 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 …

Show a custom error text using ErrorDocument in htaccess

March 21, 2021 0 Comments

Last Updated on April 11, 2021 by amitoverflow1 With ErrorDocument directive it is also possible to show a custom error text instead of redirecting the request to error page. You can use your own error text message that will be displayed to broken requests on the server. Here is an example : ErrorDocument 404 “Sorry …

5 awesome htaccess rules you can just copy and paste

March 21, 2021 0 Comments

Last Updated on April 20, 2021 by amitoverflow1 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 …

Redirect vs RedirectMatch how to use these directives in htaccess

March 20, 2021 0 Comments

Last Updated on April 18, 2021 by amitoverflow1 Redirect and RedirectMatch both directives are part of Apache core modules which means that you don’t need to install anything on your server to use these directives as they come pre installed with your server. Redirect and RedirectMatch are used for external URL redirection. The difference between …

How Mod-rewrite END flag works in htaccess file?

March 18, 2021 0 Comments

Last Updated on April 12, 2021 by amitoverflow1 END flag is used in RewriteRule to terminate the internal Rewriting process. When the rule matches the END tells server to shut down the internal Rewriting that happens only on htaccess context but not in server.config as this file is read only once by the server. END …