Search code examples
apachebrowserdnshttp-redirectubuntu-server

Web browsers removing slash in URL


I have a URL (http://www.example.com/). Whenever me, a user, or a bot(search indexers) enter (http://www.example.com/Folder) the domain automatically redirects to (http://www.example.comFolder). All browsers are removing this slash. This also applies to files and subfolders, the slash after .com is removed and the user is redirected to their default DNS search site.

What can I configure, either with DNS or on my server, to prevent the root slash from disappearing?

My Server is configured:

  • Ubuntu 14.04 VPS
  • Running Apache, PHP, MySQL
  • Domain purchased through NameCheap
  • Site uses CloudFlare DNS

Any ideas would be greatly appreciated


Solution

  • Check the configuration file in /etc/apache2/sites-available/your_site_name.conf. If you have a Redirect "/" "https://your_site_name.whatever", it might be that the redirect is stripping the forward slash from the URL there. If this is the problem, just add a trailing forward slash to the redirect url. This is what happened to me. I could navigate to the index.php but not to the info.php file I had placed at the root when I set up the virtual host.