Jump to content

how to remove *.php extension in address url ?


Recommended Posts

I have a question about apache.

I have WAMP version 3.1.9

apache 2.4.39

I want to remove the *.php extension in the url

in the .htaccess file which I placed in the directory ; I added the following code

 
 RemoveType *.php

but still when going to a page I see the php extension

in the apache pages I read that the loaded module should be mod_mime 

https://httpd.apache.org/docs/2.4/mod/mod_mime.html#removetype

(i can see its loaded when checking php_info() ) 

still I dont have any result. 

What more directives are needed?

Or is there another approach for removing file extensions?

 

Link to post
Share on other sites

it is enabled. I can see it in php_info() in the list under apache2handler : loaded modules

Other directives do work in the .htaccess file, but this one doesn't.

Are there additional requirements?

Edited by BrainPill
Link to post
Share on other sites

I tried to put this in the htaccess file

AllowOverride All
 
RewriteEngine On
RewriteRule ^([^\.]+)$ $1.php [NC,L]

But this makes the request crash

the apache error logs tells: 

Quote

[Tue Feb 25 13:52:53.697348 2020] [core:alert] [pid 10960:tid 1236] [client ::1:50614] C:/wamp64/www/mydirectory/.htaccess: AllowOverride not allowed here, referer: http://www.myvirthost.loc

Why is this error showing up?

Link to post
Share on other sites
13 hours ago, dsonesuk said:

I have this direction placed in the vhosts file

 

 Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
 	   Require all granted

Could it be any other script that still overrides this ? I tried the same ones in the httpd.conf file but I am not sure how to do it. 

Is the httpd directive more determining for instance ?

What else could it be? 

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...