4

I am currently working a project with PHP and Apache on a local server using XAMPP. I have an issue on my website, I was wondering if I can delete the last slash of my web URL. For example, I'm running a website in localhost and it was stored in folder htacces\web\mywebsite and when I open the website in the browser, the URL bar shows localhost/web/mywebsite/ or 127.0.0.1/web/mywebsite/.

So if this is normal then it's fine, but why can some site like stackoverflow.com remove the last slashes, also like stackoverflow.com\question\ask?

I just want to know about that, is .htaccess will do? or PHP? here is the .htacces file that I have written in my website

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?$1 [QSA]

Could anyone help?

unor
  • 92,415
  • 26
  • 211
  • 360
Irvan Hilmi
  • 378
  • 1
  • 4
  • 16

1 Answers1

1

the slash on the end doesnt make much difference. So you just could ignore it, but if you want to allow opening the directories without slash you cant do that in the .htaccess file i think.

TheBlueOne
  • 486
  • 5
  • 13