Laravel keeps removing the www from my URI, how to stop this? - url

i have installed a laravel application onto my hosted solution . now every time i access the site laravel is removing the www from the URI . Example www.example.com becomes example.com. i need the www to stay. please help if you can. thanks.
i have found the following.
here is the url - http://www.example.com/portal?reseller_id=1.
with this URL the www gets removed. but with the following URL it doe not .
http://www.example.com/portal/?reseller_id=1
any ideas?

Are you sure that's Laravel? The core/base Laravel code doesn't do any examining of the hostname, and should serve up the application for both the www and non-www versions of the domain. It sounds more like you have an .htaccess rule setup, or possibly your webhost has a server level configuration, that's removing the www. I'd test it out with a simple helloworld.php file before spending too much time debugging the framework.

Related

How to forward non-www URLs to www URLs

I've had an issue with Google Adsense not being able to access their config file (ads.txt) on my Rails site. I have put it in what I think is the correct folder (App -> Public).
In summary, this is the situation for which URLs work vs not:
[webURL].co.uk/ads.txt (works)
https://www.[webURL].co.uk/ads.txt (works)
http://www.[webURL].co.uk/ads.txt (works)
https://[webURL].co.uk/ads.txt (doesn't work - hangs)
http://[webURL].co.uk/ads.txt (doesn't work - error - HTTP Status: 404 (not found)
So my guess is that Google is trying to reach ads.txt via a URL without a www (the two bottom of the list above).
A couple of other points:
My Rails app is hosted on Heroku and I have a GoDaddy domain
On Godaddy, I have domain forwarding already setup, and so [mysite].com gets forwarded to www.[mysite].com.
So my question - how do I get URLs which don't have 'www' in them, to redirect to the equivalent URL with 'www'?
Any ideas?
Thanks in advance!
I resolved this by setting up Cloudflare and configuring some forwarding rules.

Rails app served under url segment behind ingress

I am looking for ideas on how to solve the following problem. I want to serve a rails app under an URL segment. The path to the rails app will be https://example.com/app. The landing page https://example.com/ will be bunch of static HTML, CSS, and javascript.
This will be handled by ingress in a kubernetes cluster. Ingress is easy, I have all that configuration ready but the problem as I see it is how to handle redirects between Location /app and Location /.
Is there anything in rails that prevents this? Is it just a matter of trial and error?

Craftcms route is not working in local, but it's working on server

How are you?
Yesterday, I deployed craftcms project 2.9.2 on my local. But the route is not working for me.
For example, if I type as localhost in my browser(http://localhost), it's working but if I click any item on the home page(http://localhost/collection), it's not working, I'm facing Not Found page as default. This project is working on a cloud server.
I'm not sure why it's not working when routing.
Please help me.
Thanks!
It's possible something's misconfigured.
I'd start with the env looking for a base url that needs fixed.
I'd go to the site settings if you haven't got the base url in your env
Then I'd log in to craft and check the sections. If the paths have a full url baked in then you'll have issues.
I had a similar issue and it turned out my .env file had the dev server public paths set to = "http://localhost:9090", but they needed to be https.
Once I set them to "https://localhost:9090" the routing worked.

Zend Framework 2 index.php in root folder

I am bulding a website with zend framework 2 and a URL typically looks like this:
domain.com/public/routename/action/params
In the skeleton application i don't have index.php by default, so i created one what basically includes the index.php from the public folder.(This is absolutely not the correct solution). What works but slows down the whole website, also the redirect plugin still redirects to domain.com/public/routename/action/params insetad of domain.com/routename/action/params
How could i skip the "public" in the URLs and get the redirect plugin to work?
Either you can do this from webserver from where you can point the public folder index.php so either point the domain to zf2 you should point to zf2/public/index.php
Another way is you can use htaccess and remove the public url
You should configure your web server so that it serves from public instead of the ZF2 root folder.
Not sure if you use IIS or apache or NGiNX, so without those details it is hard to say what you need to do exactly. But it should be easy to find a 'how to' for your particular web server.
It comes down to configuring what folder should be server for that particular virtual host.
Google can help you

Joomla Site URL

I have a website on a 1and1 server. I have 2 domains on the package; the default url somenumbers.websitehome.co.uk and my actual URL.
The problem is, Joomla quotes the somoenumbers.websitehome.co.uk in system e-mails instead of my actual URL. They both point to the same directory I just don't want to give a stupid URL to my users.
I think I have narrowed it down to the $siteUrl variable but I'm not sure how to go from here.
Thanks
James
At first I thought this sounded largely like a DNS issue - but then you said you only have 1 Joomla installation and both domains point to that directory.
If they're both pointing to the same directory, then both domains will display the same Joomla installation. That is, unless you're checking to see where they are coming from and having the content display dynamically based upon how they got to your site - but from your comments I doubt you're doing that. How your domains are behaving is the expected response if you're pointing them both to the same directory.
If you want 2 sites on the same hosting? Setup 2 databases (or apply different prefix for each site and use 1 database) and set up each website in it's own directory.
Adjust the DNS of each domain name (and subdomain name) to point the appropriate directory.
From there, use the .htaccess file and SEF URL's to get rid of any indicator of the directory so that it displays the same as if the site was in the root directory.
That is the best way to accomplish what you're after - because from the sounds of it Joomla is doing exactly as it should, displaying correctly what is in the directory since both domain names point to the same directory.
$siteUrl should be left blank.

Resources