View Single Post

  #5 (permalink)  
Old 04-23-2008
Rik Wasmus
 
Posts: n/a
Default Re: Problem with my Search Engine Friendly URLs in PHP.

On Wed, 23 Apr 2008 12:34:01 +0200, Jerry Stuckle
<jstucklex@attglobal.net> wrote:
> Bruno Rafael Moreira de Barros wrote:
>> On Apr 22, 8:16 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
>>> On Tue, 22 Apr 2008 21:01:13 +0200, Bruno Rafael Moreira de Barros
>>>
>>> <brunormbar...@gmail.com> wrote:
>>>> I have this framework I'm building in PHP, and it has Search Engine
>>>> Friendly URLs, with site.com/controller/page/args... And on my View
>>>> files, I have <?=$this->baseURL;?>
>>> Don't rely on short_tags, and especially not on <?=$var;?> syntax...
>>>
>>>> to print the base URL on the links
>>>> (eg. <a href='<?=$this->baseURL;?>/controller/page/args'>Go
>>>> somewhere</
>>>> a>. But on the CSS / JS files, how will I do it? I wonder, because on
>>>> the View files, I can do <?=$this->baseURL;?>/css/site.css, and it
>>>> will work. But images on the CSS stylesheet don't have the same
>>>> possibility, and they can't be static URLs for code portability, nor
>>>> they can be relative URLs because they would just get added to the
>>>> Search Engine Friendly URL.
>>> Unless there's an extra path not in your example, if in baseURL there
>>> only
>>> is a domain name, you can leave it out all together...
>>> href="/css/site.css" will just get it relative from the root, which is
>>> my
>>> preferred method.

>> Yeah but the problem is if my scripts are not deployed on the root....
>> It is really bad.

>
> If you're talking about using include(), require_once(), etc., that's a
> different story. But the client doesn't see those as links anyway, so
> it doesn't make any difference search engine wise.
>
> Like Rik says - just use relative links.


It think he's looking for a 'just dump anywhere package' solution (so it
may be in root but also on a different level). In which case, URLs in CSS
stylesheets to images for instance are somewhat trickier. I'd say the most
flexible solution for that is to use a simple PHP file as CSS augmenting
the URL as needed.
--
Rik Wasmus
Reply With Quote