문제

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
도움이 되었습니까?

해결책

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] 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top