Posted inProgramming

.htaccess file Not Working on server with PHP – Fix

.htaccess file Not Working on server with PHP – Fix

Today, We want to share with you .htaccess file Not Working on server with PHP – Fix.
In this post we will show you .htaccess file Not Working on server with PHP – Fix, hear for .htaccess file Not Working on server with PHP – Fix we will give you demo and example for implement.
In this post, we will learn about .htaccess file Not Working on server with PHP – Fix with an example.

simple .htaccess is Apache’s and all other server to directory-level steps configuration file. It all the allows end user permistion to configure authentication all the user and admin and other all the options without simple editing main here httpd.conf file.For : htaccess file Not Working on server with PHP – Fix

Common Usage of .htaccess file :

There are the Follwing list of the common usage of .htaccess file.

  • – Authorization, authentication using by .htaccess
  • – Rewriting URLs using by .htaccess
  • – Blocking using by .htaccess
  • – Directory listing using by .htaccess
  • – MIME types using by .htaccess
  • – Cache Control, and many more.

Step : 1 Configure Apache mod_rewrite

     a2enmod rewrite

Step : 2 add the following simple code to /etc/apache2/sites-available/default change

    AllowOverride All

Step : 3 Restart apache

    /etc/init.d/apache2 restart

Common .htaccess Problems

.htaccess needs to be enabled with AllowOverride –

sudo service apache2 restart

The filename is misspelled or does not begin with a “.”

The .htaccess filename is all lowercase.

 htaccess //wrong
 .htaccess //true

Conflicting .htaccess files (2 or more file)

here put only one .htaccess file not put 2 or more file in root dir.

Enabling .htaccess file (not working)

you have to go to here following folders /etc/apache2/
There will be a open this file named apache2.conf
Edit this code


    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

Now restart apache.

service apache2 reload

Step 1 : Simple Edit file or creatfile config

/etc/apache2/conf-available/httpd.conf

Add This call


    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

simple Enable this config file command run

sudo a2enconf httpd

Restart or reload Apache

sudo service apache2 restart

or other command fire…

sudo service apache2 reload

AccessFileName set to .htaccess

# grep -i AccessFileName httpd.conf

users are allowed to use .htaccess file

# grep -i AllowOverride httpd.conf

AllowOverride ALL

# service httpd restart	

If your .htaccess file is not working, there could be several reasons why. Here are some common causes and solutions:

.htaccess file is not enabled: Make sure that the Apache mod_rewrite module is installed and enabled on your server. You can check this by creating a PHP file with the following code and running it on your server:


This will show you the list of enabled modules. Look for mod_rewrite and make sure it is listed.

  1. This will show you the list of enabled modules. Look for mod_rewrite and make sure it is listed.
  2. Incorrect syntax in .htaccess file: Make sure that the syntax in your .htaccess file is correct. Even a small mistake can cause the file not to work. Check for typos, missing characters, or incorrect syntax in your file.
  3. .htaccess file is not in the correct directory: Make sure that your .htaccess file is in the correct directory. The file should be placed in the root directory of your website or in the directory where you want to apply the rules.
  4. Overrides are disabled in Apache configuration: Make sure that the Apache server configuration allows overrides. This can be checked in the main Apache configuration file (httpd.conf). Look for the <Directory> section that matches your website root directory and make sure that the AllowOverride directive is set to All.
  5. File name is incorrect: Make sure that your .htaccess file is named correctly. The file name should start with a dot (.) and have no file extension. Check to make sure you didn’t accidentally name it something like htaccess.txt.
  6. Permissions issues: Make sure that the .htaccess file has the correct permissions. The file should be readable by the web server. If you’re unsure, try setting the permissions to 644 (-rw-r--r--) using your FTP client or command line.
  7. Server configuration issues: If none of the above solutions work, there may be an issue with the server configuration. Contact your web hosting provider or system administrator for further assistance.

By addressing these common causes, you can usually get your .htaccess file working as expected.

We hope you get an idea about .htaccess file Not Working on server with PHP – Fix
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

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

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype