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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:58:12+00:00 2026-05-20T03:58:12+00:00

I have a very basic two-page website: the home page, and an about page.

  • 0

I have a very basic two-page website: the home page, and an about page. What I’m trying to do is use htaccess to rewrite the URLs so that the appear as:

  • domain.com/ (for the home page)
  • domain.com/about (for the about page)

In the actual folder structure of the site, the homepage is /index.php and the about page is /about.php (both appear in root).

I’ve been doing research into using alias but unfortunately my hosting (Dreamhost) doesn’t allow access to httpd.config so that’s out the window and I’m left with using rewrite rules in the htaccess file.

Since the index.php file will appear in the domain root (http://domain.com/) automatically, I’ve so far managed to make the about page appear correctly at domain.com/about using these lines:

RewriteEngine On
RewriteRule ^about$ /about.php

I’m also using 301 redirects so that for example, domain.com/about/ (with the trailing slash) also directs back to the /about URL like this:

Redirect 301 /about/ http://domain.com/about 

This works great.

However the index.php and about.php files still also show if you go to the correct URL within your browser (eg: domain.com/about.php) so as a result the search engines are seeing (and indexing) two versions of each page! I’ve set up the correct canonical metadata within each page but this doesn’t seem to have had any effect (the canonical metadata have been within the page markup ever since the site went live).

So how would I go about firstly doing a ‘blind’ rewrite (for want of a more technical term) for the two files so that the URLs look correct, but also effectivly ‘block’ direct access to the files – ensuring that if someone were to attempt to access the php files directly, the URL would still appear in the visitor’s browser as the ‘pretty’ versions rather than the full file name and php extension?

Any advise would be hugely appreciated, I’ve been researching this for another couple of days now (I don’t think there’s anything quite the same as this anywhere on here already) and cannot for the life of me work this one out!

  • 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-20T03:58:12+00:00Added an answer on May 20, 2026 at 3:58 am

    Check $_SERVER['REQUEST_URI'] in the PHP files. If that contains the filename (instead of the URI that you want), then do a 301 or 404 or whatever you want. Else serve the page as usual.

    You can also do a

    RewriteRule ^about.php - [L,gone]
    

    or

    RewriteRule ^about.php /about [L,R=301]
    

    but this has to go before your other RewriteRules. It will send a 410 Gone or a 301 Moved Permanently response if the page is accessed via /about.php. See Apache Module mod_rewrite for the complete documentation of mod_rewrite.

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

Sidebar

Related Questions

I recently upgraded VS 2005 to VS 2008. Unfortunately I have a very basic
I am implementing a very simple file database. I have 2 basic operations: void
i have very simple problem. I need to create model, that represent element of
I have a very large code base that contains extensive unit tests (using CppUnit).
I have a basic repository framework that eventually executes a query and maps the
I have a very basic question. I want to retrieve a zip code automatically
I have a very basic understanding of shell scripting, but what I need to
We have very strange problem, one of our applications is continually querying server by
I have very little experience building software for Windows, and zero experience using the
I have very simple select like this: SELECT * FROM table WHERE column1 IN

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.