0

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 

1 Answer 1

0

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] 
Sign up to request clarification or add additional context in comments.

7 Comments

i have copied this code to .htaccess ,its not working
I've tested it, and it's working. Does mod_rewrite is enabled? Or it's just rewrite rules not working?
Maybe because another .htaccess file is overriding, check if there are another redirections in parent directories, if so we'd do it differently
There is no redirections in the parent directory.
So does it throws any error? or just it does nothing?
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.