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.