I'm creating some templates that will be loaded remotely on a secondary domain, so I need to ensure that all generated html uses absolute paths.

After what feels like a pretty exhaustive search, I'm coming up empty. All ideas on how I could do this are welcome.

To clarify, I want drupal to automatically prepend all paths (e.g. in primary, secondary links, css file src values, images, etc.) with the full http://my.domain.here/ full, absolute path.

I don't want to hard code this into the templates. I'd rather there were a setting somewhere or a template override I could use to force this behavior automatically...

Help :)

thanks!~

Comments

Voight-Kampff’s picture

I can force absolute paths on most links generated by drupal by altering the following:

/includes/common.inc line 1179

Change from:

  $base = ($absolute ? $base_url . '/' : base_path());

To:

  $base = (TRUE ? $base_url . '/' : base_path());

Note that the style sheet paths are still root relative, not absolute. Working on that now.

I really don't want to hack the common.inc file directly. url() is not a themable function so I can't override it in my template.php file. Any help on alternate way to override would be welcome.

pramudya81’s picture

Have you ever heard of path filter module?
This may what you need...

charles belov’s picture

Drupal 6 newbie here. Note that all the URLs below are fake.

I want all links (menus links, input local links) to use absolute paths, not absolute URLs or relative paths.

That is I want all hrefs internal to the site to start with /pathwithinsite and not with http://www.mydomain.com/big/long/path/to/my/first/site/pathwithinsite that will eventually wind up at http://www.mydomain.com/big/long/path/to/my/final/site/pathwithinsite.

For RSS feeds I want to provide an alias URL http://www.mydomain.com/alias/pathwithinsite that I will reroute via .htaccess or httpd.conf to the appropriate folder, not the actual URL http://www.mydomain.com/big/long/path/to/my/first/site/pathwithinsite that will eventually wind up at http://www.mydomain.com/big/long/path/to/my/final/site/pathwithinsite.

I'm concerned that when I move a test folder to a production folder, that some links will point back to the test folder, as that is what happened when I moved the site from test folder 1 to test folder 2.

The Path Filter module only appears to be configurable for specific input formats, not for the entire site, e.g. menus added by the administrator.

Charles Belov
SFMTA Webmaster
http://www.sfmta.com/