Dynamo

3 replies to this thread. Most Recent

David Owen

26 Jan 2018, 12:08 pm

[Pro] <base href="/" />

I’ve used <base href="/" /> on particular pages in a site, in conjunction with a CMS which is creating some awkward URL’s to tidy up using .htaccess and maintaining the resources keep pointing to the page in the top level folder.

http://site.com/page.php?area=area/town/

.htaccess changes this to

http://site.com/area/town/

Using <base href="/" /> clears this up wonderfully. However as this is browser fix, has anyone heard of any downsides to this method?

www.ineedwebhosting.co.uk

Freeway Friendly Web Hosting, Domain Names, VPS and Dedicated Servers. (Create an account it’s Free!)


PrintlineAdvertising.co.uk

Print Design, Digital and Litho Printers, Promotional Merchandise and Corporate Gifts.

waltd

26 Jan 2018, 1:52 pm

I have written just such an awkward CMS at least three times, so I know the problem you are facing here. No, there is no downside to this fix that I know of. The right fix would be to have the CMS’s “friendly URL” redirect be written better (can’t say as I have ever worked out how to do that myself, just started using Rails 8 years ago and never looked back). Freeway’s relative URLs are absolutely correct and proper, and work 100% of the time, unless the CMS assumes there is no relation between the filesystem and the URL.

Walter

On Jan 26, 2018, at 7:08 AM, David Owen <[email protected]> wrote:

I’ve used <base href="/" /> on particular pages in a site, in conjunction with a CMS which is creating some awkward URL’s to tidy up using .htaccess and maintaining the resources keep pointing to the page in the top level folder.

http://site.com/page.php?area=area/town/

.htaccess changes this to

http://site.com/area/town/

Using <base href="/" /> clears this up wonderfully. However as this is browser fix, has anyone heard of any downsides to this method?

Freeway user since 1997

http://www.walterdavisstudio.com

David Owen

27 Jan 2018, 9:40 am

Walter,

Thanks. I’ve been struggling finding a way of fixing these URL’s for ages when I stubbled across this fix. Couldn’t believe it was so easy and must be a downside somewhere.

I’m using the basic Perch CMS. I believe Perch Runway handles routing a whole lot better as the pages you create are held in the CMS rather than Perch Basic where you’re simply inserting the CMS into static pages.

David Owen http://www.davidowendesign.com

On 26 Jan 2018, at 13:52, Walter Lee Davis <[email protected]> wrote:

I have written just such an awkward CMS at least three times, so I know the problem you are facing here. No, there is no downside to this fix that I know of. The right fix would be to have the CMS’s “friendly URL” redirect be written better (can’t say as I have ever worked out how to do that myself, just started using Rails 8 years ago and never looked back). Freeway’s relative URLs are absolutely correct and proper, and work 100% of the time, unless the CMS assumes there is no relation between the filesystem and the URL.

Walter

On Jan 26, 2018, at 7:08 AM, David Owen <[email protected]> wrote:

I’ve used <base href="/" /> on particular pages in a site, in conjunction with a CMS which is creating some awkward URL’s to tidy up using .htaccess and maintaining the resources keep pointing to the page in the top level folder.

http://site.com/page.php?area=area/town/

.htaccess changes this to

http://site.com/area/town/

Using <base href="/" /> clears this up wonderfully. However as this is browser fix, has anyone heard of any downsides to this method?

www.ineedwebhosting.co.uk

Freeway Friendly Web Hosting, Domain Names, VPS and Dedicated Servers. (Create an account it’s Free!)


PrintlineAdvertising.co.uk

Print Design, Digital and Litho Printers, Promotional Merchandise and Corporate Gifts.

Back to Top

Todd

29 Jan 2018, 3:19 am

Here’s how I do it.

In the .htaccess file:

RewriteEngine On
RewriteBase /

 # The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

In the document head:

<base href="[[!++base_url]]">

Note: The [[…]] part is unique to my CMS.

Todd QREATiv Community Project | https://qreativ.space