[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?


dynamo mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

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@hidden 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?


dynamo mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

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@hidden 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@hidden 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?


dynamo mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

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


dynamo mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options