FreeCAD / FreeCAD-Homepage

The homepage at http://www.freecad.org
GNU Lesser General Public License v2.1
23 stars 38 forks source link

FreeCAD Website - .htaccess hack to dissappear .php extension from URL #84

Closed FreeCAD-Bug-Importer closed 4 months ago

FreeCAD-Bug-Importer commented 2 years ago

Issue imported from https://tracker.freecad.org/view.php?id=4019

Original report text

Currently the website displays /downloads.php The request is to update the .htaccess so that the extension will be invisible AKA /downloads

Related Forum thread

Github issue: https://github.com/FreeCAD/FreeCAD-Homepage/issues/42

Other bug information

Discussion from Mantis ticket

Comment by Kunda1 2019-06-15 14:44

Solution: In the .htacccess file add the following lines:

#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]

RedirectPermanent /download.php /downloads
RedirectPermanent /download /downloads 
yorikvanhavre commented 2 years ago

Hmm I added the change above but it doesn't seem to work. I think it is because our server runs nginx and htaccess is used by apache only?

luzpaz commented 2 years ago

I don't use NGINX so can someone confirm this would work? https://fedingo.com/how-to-remove-php-from-url-in-nginx/

kkremitzki commented 4 months ago

This is implemented now.