Tag: -htaccess

Force Trailing Slash

Add the following to your .htaccess file to force a / at the end of the URL. <IfModule mod_rewrite.c> RewriteCond %{REQUEST_URI} /+[^.]+$ RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] </IfModule>

Change the Directory Index Page

By default your server will use index.html and / or index.php as the default index page of a directory. You can easily change the directory index by adding…

Remove File Extensions from URLs

Removing file extensions from URLs will not have any impact on your SEO, it will make your website URL look cleaner, can make your website file structure appear…

Remove the WWW from the Beginning of the URL

Add the following to your .htaccess file to remove the WWW. from the beginning of the URL. # Rewrite www.example.com → example.com <IfModule mod_rewrite.c> RewriteCond %{HTTPS} !=on RewriteCond…

Force the WWW at the Beginning of the URL

Add the following to your .htaccess file to force the WWW. at the beginning of the URL. # Rewrite example.com → www.example.com # Use with caution, as this…

WWW, No WWW or Both?

When creating and establishing a website, website owners ponder if they should use www, no www or both. They wonder if their end users will care which one…

Set Expires

The Expires header specifies a date after which a resource is invalid. At that point, the browser will ask for the resource again. This caches the resource so…

Creating a 404 “Not Found” Error Page

If you’ve been on the Internet long enough or if you have a website yourself for a decent amount of time, you’ve probably heard of or encountered 404…

Prevent Hotlinking using .htaccess

Hotlinking is where another website, let’s say XYZ.com, uses the asset(s) of another website, let’s say ABC.com, by using the direct link to that asset. This is known…

Increase PHP Memory Limit with .htaccess

You can increase the allotted PHP memory limit using .htaccess, useful for WordPress, with the following line:phpvalue memorylimit 64M In this example the new allotted PHP memory limit…