Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Small Htaccess issue

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

T D S

Established Member
Impact
9
So I had a site setup on a subdomain which I moved to the main domain. I was trying to setup a 301 redirect from the subdomain to main but have ran into a problem

original url was in this format http://www.subdomain.some-domain.us i want to 301 redirect to http://www.some-domain.us but the code I used ended up doing this instead http://www.some-domain.us/subdomain

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} www.subdomain.some-domain.us$ [NC]
RewriteRule (.*)$ http://www.some-domain.us/$1 [R=301,L]

Could someone add me in fixing this issue

Alright got this and it works but seems there should be an easier way
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^directory.search-for.us$ [OR]
RewriteCond %{HTTP_HOST} ^www.directory.search-for.us$
RewriteRule ^/?(.*)$ http://www.search-for.us/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^search-for.us$ [OR]
RewriteCond %{HTTP_HOST} ^www.search-for.us$
RewriteRule ^directory/?(.*)$ http://www.search-for.us/$1 [R=301,L]

So right now it goes from subdomain.domain.com to domain.com/subdomain and then to domain.com

Is there a more proper way? or shorter version?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Appraise.net

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

Watched threads: your alert now keeps up with new replies
When you watch a thread, each new reply now updates your alert. Before, you got one alert and then nothing until you read the thread...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back