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 6912493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:05:56+00:00 2026-05-27T09:05:56+00:00

Possible Duplicate: Remove .php extension with .htaccess I’m trying to hide the .php file

  • 0

Possible Duplicate:
Remove .php extension with .htaccess

I’m trying to hide the .php file extension but for some reason can’t get it to work. My latest attempt was the following:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule ^folder/([a-zA-Z_\-0-9]+)/?$ /folder/$1.php
</IfModule>

I have tried many different variances of code I have found online but still no luck. The .htaccess file is placed within the root directory.

  • 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-05-27T09:05:57+00:00Added an answer on May 27, 2026 at 9:05 am

    I’ve used this:

    RewriteEngine On
    
    # Unless directory, remove trailing slash
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/]+)/$ http://example.com/folder/$1 [R=301,L]
    
    # Redirect external .php requests to extensionless URL
    RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
    RewriteRule ^(.+)\.php$ http://example.com/folder/$1 [R=301,L]
    
    # Resolve .php file for extensionless PHP URLs
    RewriteRule ^([^/.]+)$ $1.php [L]
    

    See also: this question

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

Sidebar

Related Questions

Possible Duplicate: How to delete a zip file using php How can I remove
Possible Duplicate: php - efficent way to get and remove first line in file
Possible Duplicate: Redirect *.htm to *.php htaccess rewrite if redirected file exists I set
Possible Duplicate: Php: remove all tags, but “a href” in a text Is there
Possible Duplicate: PHP: How to remove specific element from an array? How can i
Possible Duplicate: Get Client IP using just Javascript? I know PhP can know your
Possible Duplicate: How can I stop Filezilla changing my linebreaks? For some reason Filezilla
Possible Duplicate: PHP code to remove everything but numbers i have a loop that
Possible Duplicate: PHP remove accents The title says most of it, but anyways... I
Possible Duplicate: How to remove duplicate values from an array in PHP How can

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.