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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:18:53+00:00 2026-05-23T01:18:53+00:00

I have a php site. For all of the page links I use foo.htm,

  • 0

I have a php site. For all of the page links I use foo.htm, and internally rewrite this to foo.php with .htaccess:

RewriteRule ^(.*)\.htm$ $1.php [NC,L]

This works great – however, it still allows you to use the foo.php url. I would like to 301 redirect foo.php to foo.htm to prevent any old foo.php search engine results from hanging around and rewrite the foo.htm url internally to foo.php

I can’t figure out how to do this without creating a loop.

  • 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-23T01:18:54+00:00Added an answer on May 23, 2026 at 1:18 am

    Put this code in your .htaccess file:

    Options +FollowSymlinks -MultiViews
    RewriteEngine on
    
    RewriteCond %{THE_REQUEST} ^GET\s(.+)\.php [NC]
    RewriteRule ^ %1.htm [R=301,L]
    
    RewriteRule ^(.*)\.htm$ /$1.php [L,NC]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have various links on my site which are all generated via PHP MySQL
There is my site For SEO I have removed the .php extension from all
I have this code which getting html code of page and than replace all
I use PHP and MySQL to manage the content on my server/site (I have
I have a little problem with my website. People use this page to create
I have a PHP site that uses a fairly common authentication scheme. The entire
I have a requirement in my PHP site to join an image(jpg or png)
In my live site I have php include() and require() that have full path
do you have any good suggestions how to backup remote php site and mysql,
I am developing w php web site. Here I have set a php cookie

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.