user1352819
user1352819

Reputation: 1

.htaccess mod_rewrite pretty URLs with subdomain

I'm trying to get my URLs from this:

hxxp://m.newsite.com/index.php?id=12345

To this:

hxxp://m.newsite.com/12345

The trouble I have is I have a shared hosting account and I'm hosting a new domain, so the above URL w/subdomain is technically accessible from:

hxxp://www.originalsite.com/newsite.com/mobile

I've tried a variety of different combinations for mod_rewrite, but I'm afraid I'm just not there! Help!

Upvotes: 0

Views: 693

Answers (1)

Gerben
Gerben

Reputation: 16825

Put this in the htaccess in the /newsite.com/mobile directorie

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^m\.newsite\.com$
RewriteRule ^([0-9]+)$ index.php?id=$1 [L]

Upvotes: 0

Related Questions