-1

I have successfully written .htaccess code to remove .php from the url's however i want to add an exception and keep it there for some of the files (e.g. www.mysite.com/samples.php).

I have tried so many rules but nothing worked. Can somebody help me out.

I want to have an exception there as well so that it allows .php in some of the files and remove it from the others that do not lie in the exception rule.

Regards

MansoorShiraz
  • 118
  • 1
  • 8
  • Take a look at excluding the files with http://stackoverflow.com/questions/1839537/exclude-files-from-rewrite-rule-in-htaccess – worldofjr Oct 01 '14 at 20:33
  • 1
    Please post the rules you have used to remove the `.php` extension, and what you have tried that didn't work. – i alarmed alien Oct 01 '14 at 21:24
  • RewriteCond %{THE_REQUEST} ^GET\s.+\.php [NC] #RewriteRule ^(.+)\.php$ /$1 [NE,R=301,L,NC] RewriteRule ^(.+)\.php$ /$1 [NE,R=301,L,NC] RewriteCond %{REQUEST_URI} !\.php$ [NC] RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)/?$ /$1.php [L] – MansoorShiraz Oct 03 '14 at 20:41

1 Answers1

0

Why do you need to keep it there?

Do you need to add a variable to the url if so then you could do this in .htaccess

RewriteRule ^samples/(.*)/(.*)$ samples.php?var1=$1&var2=$2
makie
  • 87
  • 1
  • 6