Question

I have a custom folder with number of php files. i want to create a friendly URL by removing .php from the URL.So i have created the .htaccess file in the custom folder where all the .php files located and written the below code but its is not working.

My URL is: magento/cl/unilever.php

Expected URL: magento/cl/unilever

.htaccess contains:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^unilever $ unilver.php
Was it helpful?

Solution

Assuming you want to rewrite just single directory, try this one:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(\w*)$ $1.php [L] 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top