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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:15:38+00:00 2026-06-03T08:15:38+00:00

I have trying to achieve a url rewrite which can be fairly simple but

  • 0

I have trying to achieve a url rewrite which can be fairly simple but i am unable to figure it out, here is what i want:
i have 2 files

test.html
test.php

my url request is test.html
my htacess rule should return the test.html file , and if test.html file doesnt exists then it should return test.php , the url stays the same i.e. test.html
so in short i want to check if the html file exists then return html file and if it doesnt then return php file.

Any help will be appreciated.. thanks

  • 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-06-03T08:15:40+00:00Added an answer on June 3, 2026 at 8:15 am

    You should really just do this with default document in Apache no mod_rewrite needed. If you set test.html as the higher priority document it will get chosen if they are both there otherwise test.php will be used if it is the only one there.

    If you insist on doing this in mod_rewrite the following will work for you

    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME}       !-d
    RewriteCond %{REQUEST_FILENAME}       !-f
    RewriteRule ^test\.html$              test.php [NC,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to achieve something which I'm sure is pretty simple but I cannot
im trying to achieve something but i dont really know how I have set
Im trying to achieve an output like this {status:ok,0:{id:11,title:digg,url:http://www.digg.com}} but instead i am getting
What I'm trying to achieve here is lets say we have two example URLs:
What I am trying to achieve is the following: I want to have numerous
Here is what i am trying to achieve: I have a few Linux servers
this is what I am trying to achieve here. I have a login page
Here is what I am trying to achieve in PHP: I have this string:
I am trying to rewrite a url in wordpress so that I can serve
I have something I am trying to achieve. I have a web application running

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.