Solved

need help in mod rewrite with subdomain

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
designing in object programming 12 75
hasing a url 16 24
ignore other .htaccess 2 44
PHP insert data in to database... this is not letting me in insert data...please help! 7 34
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

776 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