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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:21:06+00:00 2026-05-29T04:21:06+00:00

Please excuse me as I’m pretty new to using .htaccess, and am having a

  • 0

Please excuse me as I’m pretty new to using .htaccess, and am having a few issues with it as the setup I need is, despite being simple, seemingly rare.

Basically, I’m working on a secondary domain trying to hide .php extensions from pages, but whilst also redirecting requests for nonexistent pages to a custom search page. The overall desired effect is:

realpage => realpage.php

and

falsepage => search.php?q=falsepage

So far, the code I have (see below) seems to apply the latter correctly, but rather than returning ‘realpage.php’ for ‘domain.com/realpage’ it returns a 404 error.

I’ve found variations which also move realpage to ‘search.php?q=missing’ in case that gives any indication what might be going wrong!

My .htaccess file at the moment:

   Options +FollowSymLinks
   Options +Indexes

   RewriteEngine On

   RewriteBase /

   RewriteRule ^([^\.]+)$ $1.php [L]

   RewriteCond %{SCRIPT_FILENAME} !-f
   RewriteRule ^(.*)\.php$ search.php?q=$1 [L]

Thanks for any help you can offer! It’s very much appreciated!

  • 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-29T04:21:09+00:00Added an answer on May 29, 2026 at 4:21 am

    I think for your first rule, you want something along the lines of:

    RewriteBase /
    RewriteRule ^([^.]+)$ $1.php [L]
    

    I ran that through the rewrite rule tester, and it will direct ‘realpage’ to ‘realpage.php’. If that doesn’t work, I would suggest disabling your second rule, making sure the first one works well, then adding the check for missing files in later.

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

Sidebar

Related Questions

New to MVVM so please excuse my ignorance. I THINK i'm using it right
I'm pretty new to javascript so please excuse this question if it seems pretty
please excuse me for simple question: i tried to write simple csv file using
Please excuse any mistakes in terminology. In particular, I am using relational database terms.
Please excuse me, today is my first day trying to setup a CI environment
Please excuse me if I'm simple here, I want to create a simple widget
I am fairly new so firstly please excuse me if I am doing anything
I'm still very new to cocoa touch so please excuse any terminology that I
I'm still new top rspec, so please excuse if this is an easy one
Note: I'm new to version numbering. Please excuse my ignorance. I have a project

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.