Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8906509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:40:27+00:00 2026-06-15T02:40:27+00:00

I just finished installing a LAMP stack on Ubuntu 12, and have run into

  • 0

I just finished installing a LAMP stack on Ubuntu 12, and have run into an issue with Apache’s .htaccess file. I have the rewrite and redirect mods enabled, and the .htaccess file is working (the URI will redirect to ‘www’ if there is no ‘www’ present), but no matter what I try, I cannot get it to remove file extensions. I’ve tried the <Files> directive with no luck. My current file consists of the following:

RewriteEngine On

# Remove file extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)$ $1.php [L]

# Force www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Any suggestions on how to fix this very annoying problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:40:29+00:00Added an answer on June 15, 2026 at 2:40 am

    You don’t use htaccess to do this, you use your app to remove the extensions, and htaccess to map extension-less urls to real files. This rule

    # Remove file extension
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (.*) $1.php [L]
    

    Says, “if the requested resource doesn’t exist as a file, look for the resource with a .php extension”. So you remove the extension from all links in your app, and this rule will make the php file run without the extension. Your htaccess is fine as-is, you need to update your app.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just finished installing libevent(1.4.8), memcached(1.4.5), pear, and libmemcached(0.40) to my lamp server (running PHP
I just finished integrating the Facebook 3.1 API into our app, and have left
I just finished porting an application from Windows into Linux. I have to create
I just finished installing VS 2012 RC and have started working with the ASP.NET
I've just finished re-installing my OS, and as always install and test standard tools
I just finished reading the HTML5 Developer's Cookbook and have a question. I've read
I finished installing Ubuntu 10 for netbooks, and XAMPP. The XAMPP website tutorial made
Just finished incorporating PHP_Beautifier into Vim and the fact that it removes whitespace irks
I am a newbie to the Zend Framework. I just finished installing Zend Server
I've just finished installing Hadoop 0.20.2 under Cygwin on Windows 7 with Eclipse Helios

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.