homepage Welcome to WebmasterWorld Guest from 54.237.134.62
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

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?
web2008




msg:4626623
 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]

subdomain
m.site.com
spins to
www.m.site.com/mobile

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]
</IfModule>

# 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]

 

phranque




msg:4626648
 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

web2008




msg:4626690
 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

lucy24




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

^(?!www\.)(.+)
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
!^(www\.example\.com)?$

<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"?

web2008




msg:4626732
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved