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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:49:26+00:00 2026-05-14T21:49:26+00:00

HI guys. Im using mod_rewrite to do some redirects on a web site. I

  • 0

HI guys.

Im using mod_rewrite to do some redirects on a web site.

I want to be able to do the following
mySite.com/ -> Goto Home
mySite.com/foo -> Goto redirect.php and redirect acordingly.

My redirect rule was

RewriteRule (^\w*$) redirect.php?url=$1 [NC]

But im oviously missing something because when I go tomySite.com/ I get sent to redirect.php

I need a regex that allow lower and upper case letters, as well as underscores but it has to ignore “empty” strings so when I go to mySite.com/ the index file is displayed.

Any help?

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-05-14T21:49:26+00:00Added an answer on May 14, 2026 at 9:49 pm
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^index.php index.php [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*$ redirect.php?url=$1 [NC]
    

    This might work. By the way, you don’t have to use () in regex to get $1 which returns everything by default.

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

Sidebar

Related Questions

I have the following script that I want the production guys to execute using
hi guys i'm posting some data to controller using jquery ajax, but i am
Hi guys I'm using wp touch to develop a mobile wordpress site, but when
Hi guys i am using the mail() from the contact form and for some
Hi guys am new to puppet and I want to execute the following command
Hi guys im using a jquery countdown, i want to set it to 16
Hi guys I am using the following code to access Camera from my application
Hi guys I'm using this code http://www.w3schools.com/php/php_file_upload.asp to upload files and it works great
In the last weeks I've seen some guys using really long names for a
Hello guys I'm using C and GTK+ 2 I want to make a simple

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.