Solved

need help in mod rewrite with subdomain

Posted on 2009-04-12
7
198 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
ID: 24125172
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
ID: 24127264
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
ID: 24127289
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 3

Expert Comment

by:iserko
ID: 24127290
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
ID: 24127306
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
ID: 24127326
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
ID: 31569293
you deserve more than this
thankssssssss
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

820 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