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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:04:13+00:00 2026-06-09T19:04:13+00:00

I am using mod_rewrite to hide file extension this code is working prefect but

  • 0

I am using mod_rewrite to hide file extension this code is working prefect but when i add slash at the end of url it’s show error 500 internal server error

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

Please help me

  • 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-09T19:04:14+00:00Added an answer on June 9, 2026 at 7:04 pm

    but when i add slash at the end of url it’s show error 500 internal server error

    This is because the slash is being grouped together in the (.*) and then referenced by $1, so a request like:

    http://your.host.com/my_file/
    

    is getting rewritten to:

    http://your.host.com/my_file/.php
    

    The reason is that the condition %{REQUEST_FILENAME}\.php exists, because the trailing slash gets ignored. You just need to include the match against the trailing slash in your RewriteRule‘s regex:

    RewriteRule ^(.*?)/?$ $1.php
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to hide actual sub-directory from url path using mod_rewrite. The folder actual
I'm setting up some simple url rewriting rules using mod_rewrite and a .htacces file,
I'm forcing HTTPS on my site using mod_rewrite but I want to change this
I'm trying to change all http://www.mysite.com/filename.php files to show as http://www.mysite.com/filename/ using mod_rewrite, but
I'm trying to figure something out. This is the code I'm using to hide
I'm using mod_rewrite to rewrite .html to .php. RewriteRule ^([0-9a-zA-Z-_]+)\.html$ index.php?p=$1 [L] But, I'm
I am using mod_rewrite to put a category name in the URL, like locahost/categoryName
I'd like to remove a cookie using mod_rewrite but unfortunately the subsequent request (Chrome,FF,Safari)
I'm using mod_rewrite in a ManagedFusion settings file (similar to .htaccess) and I want
I've been using mod_rewrite in my htaccess file to rewrite my urls and I've

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.