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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:46:08+00:00 2026-06-05T23:46:08+00:00

i am trying to create an .htaccess file that will achieve the following create

  • 0

i am trying to create an .htaccess file that will achieve the following

  1. create a clean url like this http://www.mydomain.com/About-Us with page page.php?title=About Us
  2. query a database with the parameters passed on the url like this http://www.mydomain.com/?search=abc and it pulls to page index.php?search=abc

this is my code so far

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^?search=([0-9]*)$ index.php?id=$1 ## e.g www.mydomain.com/?search=try
RewriteRule ^([A-Z]*)$ page.php?name=$1 
## www.mydomain.com/About-Us

##ErrorDocument 404 PageNotavailabale


####Protect the system from machines with worms
RewriteRule (cmd|root)\.exe - [F,E=dontlog:1]

#### To hold and redirect css/images/js files
RewriteRule images/(.+)?$ images/$1 [NC,L]
RewriteRule css/(.+)?$ css/$1 [NC,L]
RewriteRule js/(.+)?$ js/$1 [NC,L]
  • 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-05T23:46:10+00:00Added an answer on June 5, 2026 at 11:46 pm

    Why not using this kind of url for your search engine : www.domain.com/search/abc ?

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^search/([a-zA-Z0-9]+)$   index.php?search=$1
    RewriteRule ^([a-zA-Z0-9]+)$          index.php?page=$1 
    

    Then, your access your pages with www.domain.com/<myPage>.

    And your search engine with www.domain.com/search/<mySearch>

    EDIT :

    Please notice your rules doesn’t allow a lot of params :

    • ^?search=([0-9]*)$ allows only numbers (even an empty parameter)
    • ^([A-Z]*)$ allows only uppercase letters (and also empty parameter)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create a .htaccess file that would do this logic: If
I'm trying to create a rewrite condition in .htaccess file to check if url
I am trying to create a rewrite rule that accomplishes two things: Redirect (www.)?domain.com
I'm trying to create an conditional Rewrite Rule using an .htaccess file and Apache.
I am trying to create an htaccess file to redirect my entire site except
I want to create a RewriteCond / RewriteRule combination, obtaining this result: www.domain.com/dir1/old_file.php?a=1 =>
I`m trying to create a small bootstrap in php. my dirs are like this:
I'm trying to create a rule used in a .htaccess file to match anything
Trying to create a .htaccess redirect results in an infinite loop. This is what
I'm trying to create something short.com/ASWi7 -> short.com/index.php?h=ASWi7 so I tried using this code

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.