Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Fix link errors PHP, .HTACCESS

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!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading