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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:25:00+00:00 2026-05-27T21:25:00+00:00

I tried having http://domain.com/user/foobar redirected to http://domain.com/user/index.php?id=foobar using the following code in .htaccess: RewriteEngine

  • 0

I tried having http://domain.com/user/foobar redirected to http://domain.com/user/index.php?id=foobar using the following code in .htaccess:

RewriteEngine On
RewriteBase /data
RewriteRule ^user/(.*)$ user/index.php?id=$1

But for some reason only index.php (not foobar) is returned to the script as ID.

I think mod_rewrite gets confused because of the existing folder name also matching the regex pattern. It works, however, after renaming the folder to _user and accordingly modifying the above code.

  • 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-27T21:25:01+00:00Added an answer on May 27, 2026 at 9:25 pm

    Take care that the rewrite rule in your .htaccess is applied multiple times:

    0: http://domain.com/data/user/foobar
    1: /data/user/foobar -> /data/user/index.php?id=foobar
    2: /data/user/index.php?id=foobar -> /data/user/index.php?id=index.php
    

    So it always replaces your id parameter with index.php.

    You need to write a condition that if index.php is already requested, it won’t get rewritten, e.g. by checking if a file already exists:

    RewriteEngine On
    RewriteBase /data
    
    # the following condition applies to the next rule
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^user/(.*)$ user/index.php?id=$
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having problems with pushing to mercurial repository: $ hg push pushing to https://user:***@hg.domain.com/X_repo
I am having DNS issues with a certain target domain. I am using fopen()
http://code.google.com/apis/libraries/devguide.html I don't want to use Google's API key to load the various JS
I'm having trouble sending out a simple HTTP request using Actionscript 3's Socket() object.
I am having a problem using Indy HTTP (in Delphi) with the Google Contacts
I've tried using a variety of XMPP libraries for Node.js, and am having trouble
I am using paypal_adaptive gem and having some problems. This is my code in
I tried this: http://channel9.msdn.com/posts/RobBagby/deCast-Entity-Framework-Modeling-Implementing-Entity-Splitting/Default.aspx?wa=wsignin1.0 ...with the Northwind sample database from Codeplex, using the Employee
I'm using http://spreadsheet.rubyforge.org to generate a spreadsheet and I'm having trouble with something. I'm
I'm having difficulties updating RubyGems from version 1.1.1 to newest. I've tried the following:

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.