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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:08:21+00:00 2026-05-17T02:08:21+00:00

I want get everything up to the / and merge with .php works fine,

  • 0

I want get everything up to the “/” and merge with “.php”

works fine, but when the file does not exist I get internal error

RewriteRule ([^\/]*) $1.php
  • 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-17T02:08:21+00:00Added an answer on May 17, 2026 at 2:08 am

    You might want to check that what you’re rewriting to exists before performing the rewrite, to avoid a loop (noting that your test pattern matches what you rewrite to). One possible approach to this is to do the following:

    # Check that the file isn't a directory
    RewriteCond %{REQUEST_FILENAME} !-d
    # ...nor is it a file
    RewriteCond %{REQUEST_FILENAME} !-f
    # ...but the result of the rewrite will be
    RewriteCond %{DOCUMENT_ROOT}/$1.php -f
    RewriteRule ^([^/]+) $1.php
    

    This also has the (minor) benefit of showing the original URL in cases where a 404 is generated, provided you’re using the stock Apache error message. If you were to rewrite to a non-existent PHP file, the server would say that /something.php could not be found, instead of /something/, but since the rewrite is not performed when the target file does not exist, you get /something/ instead.

    If you still get a 500 error, there’s likely another conflicting rule in your .htaccess file. You should also check Apache’s error log for more detailed information about what the error was, although in this case I suspect that it was an internal redirection limit exceeded message.

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

Sidebar

Related Questions

I do: $ git commit . $ git push error: Entry 'file.php' not uptodate.
i want query a file xml with linq, i want get all descendat of
I can run normally SQLAlchemy when everything is in one file. I now want
I have a multi-line string like this: ...Togo...Togo...Togo...ACTIVE... I want to get everything between
I want to get everything in the square brackets in this phrase, including the
I am planning a new Django project and want to get everything right and
I want get the time used for a case so I can create an
I want get all of the Geom objects that are related to a certain
I want get as much as possible from Redis + Hiredis + libevent. I'm
What I want: get a xml from the AppData to use What I code

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.