homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Subdomain spins?!
What are we doing wrong?

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

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)

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)

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)

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)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved