Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 796
Stephen Cioffi Avatar asked Sep 11 '25 21:09

Stephen Cioffi


2 Answers

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.

like image 116
dascream Avatar answered Sep 14 '25 10:09

dascream


Scour your Apache configuration for Redirect* or Rewrite* rules; also all .htaccess files in the DocumentRoot. If that doesn't turn up anything, examine the PHP application you're using.

like image 30
Josip Rodin Avatar answered Sep 14 '25 12:09

Josip Rodin