Try our "Help Me AI"
Results 1 to 6 of 6

Thread: The .htaccess file | In my knowledge

  1. #1
    Status
    Offline
    TamillanSivi's Avatar
    Registered Member
    Join Date
    Feb 2019
    Posts
    77
       Rep Power
    16

    Arrow The .htaccess file | In my knowledge

    Hypertext Access file ( htaccess ) is the most common important file for allowing the designers and developers like to alter the configuration of the Apache Web Servers in order to provide extra functionalities.

    .htaccess files create methods
    First, you need to create the file ( like htaccess.txt /.htaccess files ) and you have to give the permissions of the file for 644. Then you have to add the default .htaccess codes to provide extra functions to redirect the files urls.
    Hear I mention some default .htaccess Control Access to Files codes !

    # Allowed the All files code
    deny from all
    #Allowed the All files code End

    #301 Permanent Redirects code
    Redirect 301 /olddirectory/file.html http://www.domainname.com/newdirectory/file.html
    #301 Permanent Redirects code End#Set the Email Address for the Server Administrator
    ServerSignature EMail
    SetEnv SERVER_ADMIN [email protected]
    #Set the Email Address for the Server Administrator End

    #Detecting Tablets and Redirecting
    RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$
    RewriteRule ^(.*)$ http://yourdomain.com/folderfortablets [R=301]
    RewriteCond %{HTTP_USER_AGENT} ^.*Android.*$
    RewriteRule ^(.*)$ http://yourdomain.com/folderfortablets [R=301]

    #Detecting Tablets and Redirecting code End

    # Link Protection Code
    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www.)?domainname.com/ [nc]
    RewriteRule .*.(gif|jpg|png)$ http://domainname.com/img/hotlink_f_o.png [nc]

    # Link Protection Code End

    # Rewrite URLs code
    RewriteEngine on
    RewriteRule ^content-([0-9]+).html$ content.php?id=$1

    # Rewrite URLs code End

    # Redirect Browser to https code
    RewriteEngine On
    RewriteCond %{HTTPS} !on
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

    # Redirect Browser to https code End

    # Activate SSI Code
    AddType text/html .html
    AddType text/html .shtml
    AddHandler server-parsed .html
    AddHandler server-parsed .shtml
    AddHandler server-parsed .htm

    # Activate SSI Code End

    # Change the Charset and Language headers Code
    AddDefaultCharset UTF-8
    DefaultLanguage en-GB

    # Change the Charset and Language headers Code End

    # Block Unwanted Referrals Code
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} website1.com [NC,OR]
    RewriteCond %{HTTP_REFERER} website2.com [NC,OR]
    RewriteRule .* - [F]
    </ifModule>

    # Block Unwanted Referrals Code End

    # Block Access to a Comprehensive Range of Files Code
    <Files privatefile.jpg>
    order allow,deny
    deny from all
    </Files>
    <FilesMatch ".(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$ ">
    Order Allow,Deny
    Deny from all
    </FilesMatch>

    # Block Access to a Comprehensive Range of Files Code End

    # Block Unwanted User Agents Code
    <IfModule mod_rewrite.c>
    SetEnvIfNoCase ^User-Agent$ .*(bot1|bot2|bot3|bot4|bot5|bot6|) HTTP_SAFE_BADBOT
    SetEnvIfNoCase ^User-Agent$ .*(bot1|bot2|bot3|bot4|bot5|bot6|) HTTP_SAFE_BADBOT
    Deny from env=HTTP_SAFE_BADBOT
    </ifModule>

    # Block Unwanted User Agents Code End # Wordpress default htaccess code
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # WordPress default htaccess code End
    If anyone need for .htaccess code Quotations on your mind please Ask me questions . I will be give the brief descriptions to help you!.

  2. #2
    Status
    Offline
    Bhavya's Avatar
    Administrator
    Join Date
    Apr 2018
    Location
    Vavuniya, Srilanka
    Posts
    7,687
    Blog Entries
    50
       Rep Power
    60
    Thanks for sharing this information. Above you mentioned a WordPress default htaccess code , Can we use this code for all the WordPress sites?
    You're not going to master the rest of your life in one day. Don't stress. Master the day. Make this a daily reminder.

  3. #3
    Status
    Offline
    TamillanSivi's Avatar
    Registered Member
    Join Date
    Feb 2019
    Posts
    77
       Rep Power
    16
    Yes, We can use any wordpress version sites! or All of the wordpress developed sites .

  4. #4
    Status
    Offline
    Bhavya's Avatar
    Administrator
    Join Date
    Apr 2018
    Location
    Vavuniya, Srilanka
    Posts
    7,687
    Blog Entries
    50
       Rep Power
    60
    Quote Originally Posted by TamillanSivi View Post
    Yes, We can use any wordpress version sites! or All of the wordpress developed sites .
    Thanks for your clarification and once again thanks for this information.
    You're not going to master the rest of your life in one day. Don't stress. Master the day. Make this a daily reminder.

  5. #5
    Status
    Offline
    TamillanSivi's Avatar
    Registered Member
    Join Date
    Feb 2019
    Posts
    77
       Rep Power
    16

    Red face

    Quote Originally Posted by Bhavya View Post
    Thanks for your clarification and once again thanks for this information.
    Your Welcome : )

  6. #6
    Status
    Offline
    NimeshHeshan's Avatar
    Join Date
    Jan 2022
    Posts
    20
       Rep Power
    0
    Thanks you very much for this point!

Similar Threads

  1. Replies: 0
    Last Post: 10-10-2019, 05:13 PM
  2. Practical Knowledge VS Theoretical Knowledge?
    By Moana in forum General Discussion
    Replies: 3
    Last Post: 05-06-2019, 12:19 PM
  3. how can i read amtlib.dll file ?
    By TamillanSivi in forum Technology and Design Forum
    Replies: 0
    Last Post: 03-12-2019, 09:21 AM
  4. Replies: 3
    Last Post: 08-09-2018, 03:45 PM
  5. What is the use of robots.txt file in SEO?
    By Bhavya in forum Online Marketing
    Replies: 0
    Last Post: 06-18-2018, 05:16 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Who We Are

The Hub Sri Lanka is an online community portal for all the Sri Lankan digital Citizen's to enthusiastically learn and connect with the society by enormously increasing their knowledge and careers through an extensive collaborative marketplace.

Join us
RSS RSS 2.0 XML MAP HTML