Solved

need help in mod rewrite with subdomain

Posted on 2009-04-12
7
196 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Keep getting 503 on Curl request 6 33
What is the best PDF generator to use? 1 30
Move wordpress site 3 26
using php variable inside javascript 5 16
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

863 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

26 Experts available now in Live!

Get 1:1 Help Now