beginnersbook.com

  • Home
  • All Tutorials
    • Learn Servlet
    • Learn JSP
    • Learn JSTL
    • Learn C
    • Learn C++
    • Learn MongoDB
    • Learn XML
    • Learn Python
    • Learn Perl
    • Learn Kotlin
    • Learn jQuery
  • Core Java
  • OOPs
  • Collections
  • Java I/O
  • JSON
  • DBMS

How to create .htaccess file in WordPress

By Chaitanya Singh | Filed Under: .htaccess

In the last post, we discussed how to edit .htaccess file. In this post I’m going to cover how you can create this file. If you have installed WordPress on your blog then you would be having a default .htaccess file having below content –

[code]

# BEGIN WordPress
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress [/code]

How to create it?

How to create .htaccess file in WordPress

In case you don’t have this file then you can simply create a htaccess.txt file (You may face some difficulties while creating a file named .htaccess as Windows may prevent this to happen) and copy the above content. Upload the file to server and rename it to .htaccess from htaccess.txt.

What should be the ideal file permissions for .htaccess after creation?

Do not compromise with the security of this file as this is one of the sensitive file and if you don’t prevent it viewing by others then it may cause several security issues.

The permissions should be: 644 (RW-R–R–)

In order to change the permissions login to cpanel. Refer the screenshots –

» Right click on the file and click on “change permissions”.
.htaccess-change-permissions

» Change it to 644 as shown below –
htaccess

You can do several things with this file, if you handle it properly. I’ll share more about it in upcoming posts. That’s all for now. Happy reading!!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

SEO

  • Write SEO Articles
  • Open Graph Meta Tags
  • SEO Friendly Images
  • SEOPressor Review
  • Auto Interlink Posts

WordPress

  • Free plugins to add Open Graph Tags
  • Free plugins to add Captcha
  • Set thumbnails automatically
  • Display related Posts WP
  • Change Post excerpt length WP

Website

  • Add Facebook like button
  • Add Google plus button
  • Add Twitter button
  • Create Free Website on blogspot

Copyright © 2012 – 2022 BeginnersBook . Privacy Policy . Sitemap