Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Subdomain spins?!

What are we doing wrong?



9:40 pm on Nov 28, 2013 (gmt 0)

5+ Year Member

We made subdirectory site.com/mobile and want subdomain m.site.com to point to site.com/mobile.

with .htaccess in root
# redirect no-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?!www\.)(.+) [NC]
RewriteRule ^(.*) http://www.%1/$1 [R=301,NE,L]

spins to

Inside mobile subdirectory there is no .htaccess

At the same time other subdomain blog.site.com works correctly with his subdirectory site.com/blog/

This .htacces is inside site.com/blog
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Please advise. We are getting crazy over this! What we are doing wrong?

[edited by: phranque at 4:38 am (utc) on Nov 29, 2013]
[edit reason] unlinked url for clarity [/edit]


5:00 am on Nov 29, 2013 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

i would do specific redirects of the m.example.com hostname to the /mobile/ subdirectory of the canonical hostname and the blog.example.com to the /blog/ subdirectory of the canonical hostname followed by the general hostname canonicalization redirect of example.com to www.example.com


11:04 am on Nov 29, 2013 (gmt 0)

5+ Year Member

There is nothing wrong with subdomain "blog". It works fine.
We have problem with subdomain "m" that instead going to subdirectory /mobile spins and we get Error 404.

What specific code should we write in root .htacces or /mobile folder .htaccess


12:15 pm on Nov 29, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month


What is this intended to mean? I can get it to have meaning if ?! is changed to either ?: (non-capturing group) or ?< (lookbehind) but can't work out what a lookahead would do in this location. If this is all intended as the ordinary with/without redirect, that's

<IfModule mod_rewrite.c>

Get rid of the IfModule envelope. Not its contents, just the envelope itself. There is nothing in this WordPress rewrite addressing either hostname (m.example.com) or subdirectory (example.com/m/).

This .htacces is inside site.com/blog

Do you mean that you have two separate htaccess files, both containing RewriteRules? Recipe for disaster. Collect all your RewriteRules in a single htaccess file.

Do you really want to say www.m.example.com?

What do you mean by "spins to"?


2:43 pm on Nov 29, 2013 (gmt 0)

5+ Year Member

I didn't write any code :-)

1.First .htaccess is taken from web for default redirect no-www to www

2.We have no problem with subdomain blog. I mentioned it just for example that subdomain works.

3.When we type m.site.com it goes to www.m.site.com/mobile/ with 404 error

4.When we type site.com/mobile everything is fine.

Featured Threads

Hot Threads This Week

Hot Threads This Month