Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
I need on the apache2.conf a <Directory> that hides .php extensions

I'm using a virtual machine to emulate an apache server (linux debian), and I can't manage to hide the .php file extension on the website's URL.

I'm modifying the apache2.conf in /etc/apache2/apache.conf instead of adding a .htaccess file because Apache suggests to do so.

I currently have:

<Directory /var/www/html>
    AllowOverride All
    Require all granted
    RewriteEngine On
    Options FollowSymLinks
    RewriteCond %{REQUEST_FILENAME}.php !-f
    RewriteRule (.*) $1.php [L]
</Directory>
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I suggest you to use .htaccess in directories where you want to run php files without extension.


Depends on the version of your PHP engine, add the following lines:

PHP 7.0

<FilesMatch '^[^.]+$'>
  SetHandler application/x-httpd-php70
</FilesMatch>

PHP 7.0 Single

<FilesMatch '^[^.]+$'>
  SetHandler application/x-httpd-php70s
</FilesMatch>

PHP 7.0 FastCGI

<FilesMatch '^[^.]+$'>
  SetHandler fcgid70-script
</FilesMatch>

Don't forget to remove the .php extension from such files in those directories.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!