-1

I want to rewrite my url with htaccess, when URL contains a certain string.

Example:

My url : example.com/information

When "information" is in my url, I want to rewrite to my information.php file. Hope anyone can help me out.

Amrinder Singh
  • 5,300
  • 12
  • 46
  • 88
jol123
  • 97
  • 2
  • 12
  • https://stackoverflow.com/a/4026967/6124528 – Manav Oct 10 '17 at 13:09
  • Possible duplicate of [Remove .php extension with .htaccess](https://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess) – Croises Oct 10 '17 at 13:23

1 Answers1

0

Try this:

RewriteCond %{REQUEST_URI} !/information\.php$
RewriteRule information information.php [L]

This rule will rewrite any request that contains “information” in the URL path to information.php in the same directory.

Source

Amrinder Singh
  • 5,300
  • 12
  • 46
  • 88