first i enabled mod rewrite then i used in my .htaccess this

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php

virtual hosts file is a standard installation of LAMP

ServerAdmin webmaster@localhost
DocumentRoot /var/www/webtrade

i have been trying various combinations in my .htaccess file but none worked when i access a link like domain/something it automatically becomes domain/something/ with a forward slash.

  • Please be aware that Ubuntu 18.04 LTS, which was released in 2018-April (thus the 18.04) had 5 years of standard support life, is nearing the end of those five years. You can use ubuntu-support-status to confirm if your system is still supported. Either way, if the machine is on-line, you should plan to release-upgrade asap unless you plan to use ESM/Pro, but please note ESM/Pro releases are not on-topic here when standard support ends (May-2023).
    – guiverc
    May 31 at 4:28
  • Are you certain the problem is Apache and not: (0) the site code (1) the browser (2) stale cache ? 🤔
    – matigo
    May 31 at 5:24
  • 2
    This is literally the last day (May 31st) that Ubuntu 18.04 has standard support. As of tomorrow, 18.04 is no longer supported here. Perhaps you should consider updating. May 31 at 8:29
  • No. sites ok i have ported it from xampp May 31 at 14:31

1 Answer 1


Problem solved i added the directory to apache2.conf with

<Directory /var/www/webtrade>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

and my .htaccess file

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php

in Ubuntu 20.04.6 LTS did a distribution upgrade from 18.04. automatic forward slash was gone Problem solved!!!

  • Please someone check my answer. Thanks May 31 at 16:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .