Solved

need help in mod rewrite with subdomain

Posted on 2009-04-12
7
194 Views
Last Modified: 2012-05-06
i have the following link thats for personal store
http://nsaby.com/index.php?action=mtajer&mtajerid=ajabnoor
i had set the wild card dns in my host
i need to rewrite that link to subdomain like this
http://ajabnoor.nsaby.com
0
Comment
Question by:dr_lionheart
  • 4
  • 3
7 Comments
 
LVL 3

Expert Comment

by:iserko
Comment Utility
Place the code snippet into your virtual server or directory statement.

Hope this helps
RewriteEngine on

RewriteCond %{QUERY_STRING} ^.*[\?&]?action=mtajer.*$ [NC]

RewriteCond %{QUERY_STRING} ^.*mtajerid=(\w+)&?.*$ [NC]

RewriteRule ^.*$            http://%1.nsaby.com/? [R,NC]

Open in new window

0
 
LVL 3

Author Comment

by:dr_lionheart
Comment Utility
the rewrite works ok
but it dose not show that page
this is the code for the store link
<a href=\"index.php?action=mtajer&mtajerid=$ss_link\">

Open in new window

0
 
LVL 3

Expert Comment

by:iserko
Comment Utility
Oh I get it you want it the other way round. I misread your first text, sorry.

Here's the correction (I didn't test this one yet, so let me know if it works):
RewriteEngine on

RewriteCond %{HTTP_HOST} ^(\w+)\.nsaby\.com.*$ [NC]

RewriteRule ^.*$            http://nsaby.com/?action=mtajer&mtajerid=%1 [L]

Open in new window

0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 3

Expert Comment

by:iserko
Comment Utility
Fix for line 3
RewriteRule ^.*$            http://nsaby.com/index.php?action=mtajer&mtajerid=%1 [L]

Open in new window

0
 
LVL 3

Author Comment

by:dr_lionheart
Comment Utility
ok i changed the rewrite rule to
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(\w+)\.nsaby\.com.*$ [NC]
RewriteRule ^.*$            http://nsaby.com/index.php?action=mtajer&mtajerid=%1 [L]


and the output link to
<a href=\"http://$ss_link.nsaby.com\">
and works fine
but the linke in the browser up is displayed like this
http://nsaby.com/index.php?action=mtajer&mtajerid=ajabnoor
0
 
LVL 3

Accepted Solution

by:
iserko earned 500 total points
Comment Utility
Try putting P at the end of line 3.
RewriteRule ^.*$            http://nsaby.com/index.php?action=mtajer&mtajerid=%1 [L,P]

Open in new window

0
 
LVL 3

Author Closing Comment

by:dr_lionheart
Comment Utility
you deserve more than this
thankssssssss
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now