How and where to define BASE_URL in 5.7

Permalink
What's the best way to ensure that my base url includes www?

McCormick
 
Chrouglas replied on at Permalink Reply
I'd love to see an answer for this since site.php is no longer in existence in 5.7.

I have a rather large site in development and I want to make sure I don't need to change all the links within 'content' blocks when it goes live. Will setting base_url solve this? Or is there a way to have links within content block always be relative?
zanedev replied on at Permalink Reply
zanedev
Does anybody have any idea how to get all links to be relative like the old 5.6 version? It was one of the features I loved about C5, I didn't have to go through the db file and replace all the urls when going live. I've found that setting the canonical url to the relative url works for page links but ajax requests in the dashboard like sitemap attributes menus are not using the relative (canonical) url
zanedev replied on at Permalink Reply
zanedev
Whoops nevermind it still works like it used to you just set DIR_REL like you used to, put it in one of your configs:

define('BASE_URL', 'http://localhost');
define('DIR_REL', '/mydirrel');
iwmconcrete replied on at Permalink Reply
iwmconcrete
Which 'config' exactly?
mhawke replied on at Permalink Best Answer Reply
mhawke
I just add this to my .htaccess file:
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

Of course you need to replace the 'yourdomain.com' part with your own domain name.
barkingtuna replied on at Permalink Reply
barkingtuna
Can you explain this using the following example? I built the site here, under the following domain and subdirectoryhttp://www.allinstorage.com/mlorch... and the final live site is here, athttp://www.azstorage.com. I need all of the allinstorage.com/mlorch traffic to redirect to the live/permanent site at azstorage.com.
iwmconcrete replied on at Permalink Reply
iwmconcrete
That's the way I've always done it in 5.6, but not working for me in 5.7 anymore.
ob7dev replied on at Permalink Reply
ob7dev
For 5.7:
In the URL settings in the dashboard you can set the canonical URL to include the www, and then check the box for only using canonical URLs and save your changes. The site will then always redirect to the www before your site.