Home > front end >  Fix link errors PHP, .HTACCESS
Fix link errors PHP, .HTACCESS

Time:12-27

I made a website and I created .htaccess file and I am facing to a problem. After editing .htaccess file I renamed all the links according to .htaccess in the server that I am hosting the website. But in the localhost that is not working. Always shows the error 404. How should I fix this? I need to have same links in the server and the localhost. I am hosting in infinityfree.net site and my website link is thinu-tech-demo.rf.gd.

My .htaccess file:

php_value display_errors On
php_value mbstring.http_input auto
php_value date.timezone America/New_York
RewriteEngine on
RewriteRule ^(index|contact|registration)$ $1.php [NC,L]
RewriteRule ^post/(\d )$ post.php?p_id=$1&p_title=$1 [NC,L]
RewriteRule ^category/(\d )$ category.php?cat_id=$1 [NC,L]

I tried to fix this but I failed. I need to have same links in the server and the localhost. Thanks in advance!

CodePudding user response:

You should make sure that the AllowOverride directive is set to "All" in your Apache configuration file.

<Directory /path/to/your/website>
    AllowOverride All
</Directory>

It could also be that case t hjat the Apache mod_rewrite module is not enabled on your localhost. you will need to enable the mod_rewrite module by adding the following line to your Apache configuration file (located at /etc/apache2/apache2.conf)

LoadModule rewrite_module modules/mod_rewrite.so
  • Related