Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8407341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:20:14+00:00 2026-06-09T23:20:14+00:00

I have this problem with Zend Framework wherein I want my headLink and headScript

  • 0

I have this problem with Zend Framework wherein I want my headLink and headScript to be like:

$this->headLink()->appendStylesheet('styles/my.css');

but when I view the page source of the view then click on the link of the css, the link would be like this:

http://localhost/mysite/public/user/profile/id/styles/my.css

user there is one of my Controllers and profile is of the Actions, id on the other hand is just a parameter. The link did not point to the public.

Another problem is that, when I have an AJAX script on one of my views, which acquires data from another URL like:

$(document).ready(function(){
      ...
            $.ajax({
                type: 'post',
                dataType: 'json',
                url: '../region/getcountryregions',
                data: { id : test_id },
                success: function(result){
                     // success
                }, error: function(request, status, error){
                    console.log(request.responseText);
                }
      ...
});

It works perfect on this url of mine:

http://localhost/mysite/public/user/registration

But when the URL is like:

http://localhost/mysite/public/user/profile/id/20

And both views above have the same script tags with AJAX. The problem is that the second link points the URL to:

http://localhost/mysite/public/user/profile/region/getcountryregions

And it is an error, since region is a Controller and getcountryregions is an Action of the controller region.

Is there any way I can direct the links to:

http://locahost/mysite/public/

So that links like mentioned above would be directed easily to the public path. And without affecting these links when I will be uploading it to a live server.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:20:15+00:00Added an answer on June 9, 2026 at 11:20 pm

    This is a standard relative-vs-absolute url issue. Your invocation:

    $this->headLink()->appendStylesheet('styles/my.css');
    

    implictly refers to a relative url. So, if you are on the page:

    http://localhost/mysite/public/user/profile/
    

    then the relative address styles/my.css is interpreted by the browser as relative to the current page.

    The BaseUrl view-helper can mitigate this issue:

    $this->headLink()->appendStylesheet($this->baseUrl('styles/my.css'));
    

    A similar fix for your AJAX situation applies. In your view scripts, make sure to run all your direct url renderings through the baseUrl() view helper.

    As a side note, typically, one would not expose the /public part of the url. The public directory itself would be mapped as the root of a virtual host. If you are on shared hosting and are unable to specify that mapping yourself, then there are several workarounds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am getting started with zend framework.I have encountered this problem with forms. when
I have a little experience with Zend Framework, but I like to fiddle with
I have a zend framework layout like this: ... <div id=div1></div> <?php echo $this->layout()->content;
I have a pretty weird problem related to zend framework's zend_db. I use $this
I have a similar problem to this issue: Merging 2 pdf with Zend Framework
I have this problem: I want to generate a new source code file from
I have this problem since I'm beginning in OOP programming I want to close
I have this problem in my SlashDot Menu. I want to change the picture
Apparently many people have run into this problem, but I have yet to be
I have weird problem with zend framework basics. I have simple action in IndexController:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.