[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


RewriteRule MUST require specific ending

Posted on 2006-11-19
Medium Priority
Last Modified: 2011-10-03

I use this in my .htaccess file:

             RewriteRule ^(.*)\.html index.php?page=$1 [L]

to re-write

The problem is that it ALSO rewrites



I ONLY want it rewritten if if ends in .html OR has a ? at the end (like .html?get=info )

Any ideas?


Question by:hankknight
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 43

Accepted Solution

ravenpl earned 2000 total points
ID: 17977461
RewriteRule ^(.*)\.html$ index.php?page=$1 [L]
$ matches end of string
but note, that the above will rewrite
subfolder/something.html -> index.php/page=subfolder/something
To fix it
RewriteRule ^([^/])\.html$ index.php?page=$1 [L]

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month12 days, 16 hours left to enroll

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question