LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-07-2024, 08:03 PM   #1
bionicle43
LQ Newbie
 
Registered: Feb 2024
Posts: 3

Rep: Reputation: 0
Remove trailing slashes from URL in htaccess


This is what my htaccess file looks like:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-l


RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]


But I don't know to remove trailing slashes from the url or redirect the user to a page without trailing slashes.
 
Old 02-07-2024, 09:56 PM   #2
bionicle43
LQ Newbie
 
Registered: Feb 2024
Posts: 3

Original Poster
Rep: Reputation: 0
It's alright I've solved it.
 
Old 02-07-2024, 09:57 PM   #3
bionicle43
LQ Newbie
 
Registered: Feb 2024
Posts: 3

Original Poster
Rep: Reputation: 0
Rewrite Engine On

# Redirect to page without trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [L,R=301]
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slashes in a URL Adirondacks Linux - Newbie 19 12-29-2018 05:09 PM
Apache2 trailing slashes ubuntu 12.04 child directory access Corpus-Khu Linux - Security 0 08-03-2012 11:44 AM
[SOLVED] Replacing "slashes" with back slashes - escape character problem kushalkoolwal Programming 2 01-08-2011 01:16 AM
more fun with Apache rewrites proxies and trailing slashes deesto Linux - Server 1 03-29-2010 11:05 AM
What do two forward slashes in a url mean? (not the inital 2) johnMG Linux - Networking 2 06-28-2005 10:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration