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

Need subdomain to prefix in achor tags and requests
sub domain issues

Msg#: 4394211 posted 7:36 pm on Dec 4, 2011 (gmt 0)

I have added a standard zend project into a directory off the root on a shared host. I created a subdomain sub1 that is forwarded to the sub1 folder just below ther root.

The rewrite rules seem to be working in the .htaccess file located in the
/sub1/public folder.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

When I enter sub1.main.com on the browser url line, my index.php page to the project is loaded correctly.

However, any type of request from a view script such as an anchor tag or dojo JavaScript requests are prefixed with www.main.com. I need it to prefix to be sub1.main.com. When it's www.main.com/app/index it gives me a page not found error. If I run from the browser url input field it load correctly

Is this a mod_rewrite (.htaccess) change or a Zend Bootstrapping issue?



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

Msg#: 4394211 posted 6:47 pm on Dec 5, 2011 (gmt 0)

If all your URLs are relative in the page, and not absolute, then it's most likely the browser causing the problem, not the web server.

If you go to www.example.com all relative URLs will default here unless you add a base href to the page pointing everything to subdomain.example.com, which will then try to load images and everything else relative from the subdomain.

If you go to subdomain.example.com, all relative URLs will default to this subdomain instead.

Sounds to me like you're accessing www.example.com and need to use absolute URLs directing the links to subdomain.example.com to solve your problem.

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