Questions tagged [trailing-slash]

A slash sign at the end of a URL.

A slash sign at the end of a URL.

263 questions
1
vote
1 answer

How to add slash at the end of url in htaccess?

RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*[^/])$ /$1/ [L,R=301] When I'm using this to adding slash at the end it is redirecting like example.com// But I want to redirect my url www.example.com to www.example.com/ Can any one…
user3264805
  • 27
  • 2
  • 8
1
vote
1 answer

How to remove trailing slash on blog folder in Nginx

I'm using Nginx and in my .conf file I have added a rewrite to remove all trailing slashes on the urls rewrite ^/(.*)/$ /$1 permanent; This works perfectly except for the /blog folder which enters into an infinite loop. As I understand it it is…
1
vote
1 answer

How can I have an exception for a rule in my .htaccess file?

Probably very easy question but I can't get it to work. Case: The trailing slash will be removed from the URL by the following htaccess line: RewriteCond %{request_method} ^GET$ RewriteCond %{REQUEST_URI} ^(.+)/$ RewriteRule ^(.+)$ %1 [L,R=301] # <-…
Martijn van Hoof
  • 740
  • 10
  • 28
1
vote
1 answer

Add trailing slash to url using .htaccess

I would like to add trailing slash for deep level of my urls So let's say i have this url mysite.com/work when user access that url, i want to be redirected to: mysite.com/work/ (this i want to happen) But i want this only deep levels, not for…
PHPCore
  • 121
  • 9
1
vote
1 answer

Append '/' after URL using .htaccess

Options +SymLinksIfOwnerMatch RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?url=$1 [L] How can I…
jskidd3
  • 4,609
  • 15
  • 63
  • 127
1
vote
1 answer

removing trailing slash in url but preserving it in some specific cases in htaccess

I know how to remove slashes after url, and i know how to add it also: # remove trailing slash RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)/$ /$1 [L,R=301] # add trailing slash RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^.*[^/]$ /$0/…
gergokee
  • 23
  • 1
  • 7
1
vote
1 answer

Clean URL's with .htaccess use or not slash

Yesterday I posted a question about the file .htaccess. Now is working, but I have another problem. For example: When I try to go to "localhost/about", it doesn't work, it gives me an "Error 404": Not Found The requested URL…
Enric Enrich
  • 27
  • 1
  • 7
1
vote
1 answer

Add trailing slash for specific directory (Slim framework)

What I want to achieve: www.mydomain/app => www.mydomain/app/ Only for this url. I'm using Slim Framework and this is how I handle my route: $app->get('/', function () use ($app){ // Some code goes here }); What I've tried: 1) Any results…
mintaras
  • 301
  • 3
  • 11
1
vote
2 answers

Ruby - Should I always append a slash?

Below is the Ruby code I am using to get the HTML content of webpages. I am not allowed to change this code. def getHtmlFromUrl(url) uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) http.read_timeout = 2 html =…
Kvass
  • 8,294
  • 12
  • 65
  • 108
1
vote
2 answers

Trouble with mod rewrite and slashes and $_GET

I'm trying to implement nicer urls using mod rewrite to a php script I wrote to view documents pulled from a mysql database by their entry name. i use the following code and it works fine. RewriteRule ^view.doc.(.+) index.php?doc=$1 so basically…
1
vote
1 answer

Prestashop not redirecting to correct language if missing a trailing slash (i.e. domain.com/fr)

How can I force prestashop to add a trailing slash to the language in the URL if there isn´t one? For example these links work fine to take you to the correct…
user1280853
  • 1,079
  • 5
  • 14
  • 23
1
vote
1 answer

Add Trailing Slash to URLs - Development and Production Same Rules

I've spent a bit of time attempting different methods for adding trailing slashes to my URLs, such as this one: Add Trailing Slash to URLs On my production site, this is working fine with this rule: RewriteEngine ON RewriteCond %{REQUEST_FILENAME}…
nicorellius
  • 3,715
  • 4
  • 48
  • 79
1
vote
3 answers

Avoid traliing slash for default routes in Backbone.js

I'm looking for something to accomplish in Backbone. Here is the explanation. I have backbone routes like { '': 'defaultRoute', 'test': 'test', 'testing': 'testing' } Assuming my root url is '/routes' Now when I say…
Umakant Patil
  • 2,227
  • 6
  • 32
  • 58
1
vote
1 answer

htaccess: how to remove file extesion, add trailing slash, and possibly keep the style?

I was trying to mask the file extension of html and shtml files with htaccess. I don't know much about htaccess, and what I managed to do is remove the extension, add the trailing slash to shtml pages, and stop there. I wanted to add the trailing…
tattvamasi
  • 845
  • 1
  • 7
  • 14
1
vote
2 answers

CKEditor Removing trailing slash to close tag

Last week i posted a question that CKEditor wasn't maintaining the trailing slash of the element. This though had a simple solution. Jquery .replace("
", "
"). This will be done when the Html is read from the Editor. It's not a solution…
Spons
  • 1,593
  • 1
  • 17
  • 46