?
Solved

mod_rewrite and .htaccess again...

Posted on 2004-11-19
3
Medium Priority
?
195 Views
Last Modified: 2010-03-04
Hi,

I would appreciate help on this one.
What I want to do is to translate everything after the main url into a parameter.

for example:

http://www.thesite.com/abc
http://www.thesite.com/bcd
http://www.thesite.com/cde

should all be redirected to

http://www.thesite.com

with the respective end of the url transfered as a parameter. It doesn't matter if it's the parameter name, or the value of some named parameter.

Now, when I've tried to do it myself, all that happens is that I get caught in an infinite loop to the main url, not very surprisingly.
So what I also need is a condition that checks if the url contains a questionmark '?'. In that case the request should not be redirected.

I'm a pure novice to mod_rewrite so I really need help from you guys!

Thanks,

Nick
0
Comment
Question by:Nick_72
  • 2
3 Comments
 
LVL 16

Assisted Solution

by:hankknight
hankknight earned 600 total points
ID: 12638345
0
 
LVL 16

Expert Comment

by:hankknight
ID: 12638393
0
 
LVL 5

Accepted Solution

by:
mrielf earned 1400 total points
ID: 12644824
Use this

        RewriteCond     %{QUERY_STRING} ^$
        RewriteRule   ^/(.*)$ /?$1 [R,L]

to pass url to specific variable, then modify RewriteRule

        RewriteRule   ^/(.*)$ /?variable=$1 [R,L]
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

749 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