Click here to Skip to main content
15,900,906 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Good day, if anyone could advse me on how i will go about chaging these urls
http://example.com/home.php
http://example.com/welcome/contact-us.php
http://example.com/home/support/email_us.php

to something like this
http://example.com/home
http://example.com/welcome/contact-us
http://example.com/home/support/email_us

Thanks a lot

What I have tried:

research and tried code modifications
Posted
Updated 26-May-20 1:36am
Comments
Richard MacCutchan 26-May-20 6:38am    
What is the problem? You just need to use a text editor to remove the ".php".
gavin_daCEO 26-May-20 7:01am    
i did that however it creates an error on the server
Richard MacCutchan 26-May-20 7:08am    
We really have no idea what you are doing or why. What problem are you actually trying to solve?
gavin_daCEO 26-May-20 7:09am    
i am trying to remove the .php extension
gavin_daCEO 26-May-20 7:32am    
i got a bunch of lines on how to do it on the internet and they do not work. the latest is this one #remove php file extension-e.g. https://example.com/file.php will become https://example.com/file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

1 solution

The only way is to add
RewriteRule
's to your .htaccess file that will rename your url into whatever you specify. It does take a bit of reading but it is possible.

THIS is a good starting point.
 
Share this answer
 
Comments
gavin_daCEO 26-May-20 8:15am    
thanks
Andre Oosthuizen 26-May-20 9:30am    
Pleasure.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900