1

I would like to remove .php extension for uri calls. In Linux pure machine, i can make this editing .htaccess and enable mod_rewrite. Can i make this in JElastic ?

Example: http://mydomain/company.php , i would like to called http://mydomain/company

I tried to edit .htaccess but doesn't work.

My question is how to detect this: /company.php and change it to /company directly Thanks

  • 2
    post your .htaccess. Make sure that .htaccess overwrite is enabled in your apache config. http://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess – Dimi Mar 13 '17 at 13:39
  • Yes this is possible. Please post your code that didn't work + any error messages. Also consider completely disabling .htaccess since you have full access to the Apache conf files... (better performance) – Damien - Layershift Mar 13 '17 at 15:33

2 Answers2

3

This should work:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
Gab
  • 3,404
  • 1
  • 11
  • 22
0

This is a working code, I've been using this hope this helps

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L] 

remove .php like in home.php <a href ="home" ></a>

LecheDeCrema
  • 392
  • 5
  • 21