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

  • Home
  • SEARCH
  • 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 1109093
In Process

The Archive Base Latest Questions

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

Sorry I couldn’t come up with a better title. Here is my htaccess RewriteEngine

  • 0

Sorry I couldn’t come up with a better title.

Here is my htaccess

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L,QSA]

And this is my problem:

localhost/validpage gives me the contents of localhost/validpage.php.
localhost/validpage/blah also gives me the same (validpage.php) page and so does localhost/validpage/blah/blah/…
Therefore the problem I am facing is link duplicity(in my words!).

How do I allow localhost/validpage.php to be accessed from localhost/validpage only and nothing else, not even localhost/validpage.php.

I have started a question on *Server****Fault*** too but with not much success.
The answer I have got is it cannot be done with htaccess alone.

By validpage I mean any valid page on the server. Since I am retrofitting an existing site with mod_rewrite for cleaner urls, I am looking for a relatively easy solution preferably with .htaccess only. However, any solutions are welcome.

  • 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:10:53+00:00Added an answer on May 17, 2026 at 2:10 am

    what is the source attribute of your images, etc ???
    absolute or relative?

    <img src="/images/my.jpg" /> and <img src="images/my.jpg" /> point to different files when applying your rewrite rules.

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

Sidebar

Related Questions

Sorry I couldn't come up with a better title, but it's kind of a
sorry for the unclear title but I couldn't come up with anything better. My
Sorry for the bad title, but I couldn't think of a better one. I'm
Sorry I couldn't really describe my problem much better in the title. I am
I know the title is vague, sorry I couldn't think of a better way
Sorry if the title's unclear, couldn't think of anything better since I'm still new
Sorry about the vague subject but I couldn't think what to put. Here's my
I'm sorry I could not think of a better title. The problem is the
Sorry about the title - I couldn't figure out a way to phrase it.
Sorry for spamming, but I couldn't find a better place to put my question...I

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.