Tags » Htaccess

If Your Permalinks Are Not Working

Be sure to have an .htaccess file in the root directory with the following in it:

RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]

Replace url segment or folder with htaccess

If you like to replace a url segment or folder , you can follow :


´╗┐RewriteEngine On
RewriteRule ^/?loren/lipsum/(.*)$ https://www.example.com/loren/sepcticula/$1 

How to add free SSL to your self hosted site

SSL stands for Secure Sockets Layer. It is a protocol used to encrypt communication between your computer and a remote server. Any private data you send over an SSL can only be read by the intended recipient. 637 more words


htaccess to password protect a specific server(Domain)

Some time we need to close specific domain for public.

You can write this to your htaccess file.

SetEnvIf Host staging.domain.com passreq
AuthType Basic
AuthName "Password Required"
AuthUserFile /full/path/to/.htpasswd
Require valid-user
Order allow,deny
Allow from all
Deny from env=passreq
Satisfy any

generate htpassword for set password


How to redirect non-www URLs to www?

RewriteEngine On

RewriteCond %{HTTP_HOST} ^yourdomain.com

RewriteRule ^(.*)$ http://www.yourdomain.com/$1


Linux: Apache Common Htaccess Usage (2.2 & 2.4)

  1. Maintenance mode except subnet network.

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !^/offline\.html$
    RewriteCond %{REMOTE_ADDR} !^10\.{1,3}\.{1,3}\.{1,3}$
    RewriteRule ^(.*)$ http://yourdomain.com/offline.html

    offline.html (store your offline messages)
  2. 18 more words
OS/application/sys Admin

Secure your Website with the HtAccess

 The HtAccess is a small and hidden file that is located in the main file directory of a website. Every website has an htaccess document by default, but if not, an htaccess document can also be self created and it will work just the same. 139 more words

Web Design