Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Need subdomain to prefix in achor tags and requests

sub domain issues

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?
6:47 pm on Dec 5, 2011 (gmt 0)

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

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.

Featured Threads

Hot Threads This Week

Hot Threads This Month