Questions tagged [trailing-slash]

A slash sign at the end of a URL.

A slash sign at the end of a URL.

263 questions
2
votes
0 answers

Create anchor links in URL that includes trailing slashes

I have a react app (react hooks) using strapi and gatsby. The URLs look like http://localhost:8000/en/. Note at the end of the link is a trailing slash. A few navbar links should scroll to specific sections on the homepage using anchor links. Due to…
2
votes
1 answer

Is it possible to make pathlib to treat trailing slash in a Path as significant?

There has been multiple discussions about the issue when dealing with trailing slashes in pathlib.Path, on Unix systems in particular such as https://bugs.python.org/issue21039 and https://bugs.python.org/issue39140. Given the pathlib.Path…
Alex Tereshenkov
  • 3,340
  • 8
  • 36
  • 61
2
votes
2 answers

Forcing trailing slash before query params with OkHttp3

I have a String url with queries (https://example.com/path/segments?q1=1&q2=2 for example). I need to add trailing slash (https://example.com/path/segments/?q1=1&q2=2) before queries if it does not exist using okhttp 3. How can I do this?
Alexey Nikitin
  • 604
  • 7
  • 22
2
votes
2 answers

Upload files with name contains trailing slash to AWS S3 bucket

I'm trying to upload some files to my bucket on S3 through boto3 on Python. These files name are websites addresses (for example www.google.com/gmail). I want the file name to be the website address, but in fact it creates a folder with name…
morkan
  • 171
  • 2
  • 3
  • 6
2
votes
0 answers

Remove trailing slash from ALL URL in multilingual site

I want to remove trailing slashes from www.my-site-domain/de/bilder-gallerie/. and other 5/6 URLs. My site is multilingual site. I used WPML plugin for my WP site. I used the following rules in several times in htaccess to remove trailing slashes…
Kaizur
  • 181
  • 1
  • 10
2
votes
1 answer

Issue when using .htaccess file to hide .php extension

I have the following .htaccess file on my website for removing extensions: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php This works perfectly on localhost, however, when I…
APixel Visuals
  • 1,508
  • 4
  • 20
  • 38
2
votes
1 answer

What actual role does the trailing slash is playing int the URL in two different scenarios?

Consider the first scenario : If I type in the URL https://www.w3schools.com/html into the address bar of my web browser it automatically changes to the URL https://www.w3schools.com/html/ which has a trailing slash and then the relevant web page…
PHPLover
  • 1
  • 51
  • 158
  • 311
2
votes
2 answers

PHP able to access pages in root directory from a page with slash

We're having a problem with our PHP site: http://midlandssmilecentres.co.uk/ The problem is as follows, if you were to access, for example http://midlandssmilecentres.co.uk/feedback.php, and then put a trailing slash, it returns the index page of…
Dan
  • 33
  • 4
2
votes
1 answer

How can I make a trailing slash optional for included module urls

I have a third party django app with it's own urls but they require a trailing slash. How can I support both with and without the slash?
Ryan Allen
  • 5,414
  • 4
  • 26
  • 33
2
votes
2 answers

Optional trailing slash in regex

https://embed.thatsite.com?id= https://embed.thatsite.com/?id= Im trying to get the trailing slash as optional before ?id= I tried https?:\/\/embed\.([^\/]*)\.com\/\?id=([0-9]+) //works with slash only https:\/\/embed\.([^\/]*)\.com\?id=([0-9]+)…
user5247236
2
votes
1 answer

wordpress .htacces remove final slash url

I have a website made with wordpress https://example.es/ and I'd like to remove the final slash. My .htaccess looks like this: RewriteCond %{REQUEST_URI} !wp-admin RewriteEngine on RewriteCond %{HTTP_HOST} ^www.example.es$ [NC] RewriteCond…
Anna
  • 126
  • 1
  • 1
  • 10
2
votes
1 answer

Symfony Trailing Slash Redirection Drops HTTPS

I have a Symfony endpoint that looks like this: /** * @Route("/test/") */ public function testAction(){ return new JsonResponse(['hello' => 'world']); } When I serve it on my HTTPS-enabled server (or ngrok), the following works: curl…
arik
  • 28,170
  • 36
  • 100
  • 156
2
votes
2 answers

htaccess no-trailing-slash policy: non existing urls (404) should not redirect

If I open a non existing url on my site like www.domain.de/abcde/ (with trailing slash) the url redirects to www.domain.de/abcde (without trailing slash) and opens the 404 site after. But the 404 site should come directly when the url does not…
2
votes
4 answers

Vanity URLs without trailing slashes on Apache

The code below rewrites all URLs in the /profiles/ directory on our site from example.com/profiles/name/ to example.com/name/, but we'd also like to remove the trailing slashes to further simplify the resulting URLs to the prettier example.com/name…
haadaa
  • 87
  • 11
2
votes
1 answer

exclude sub directory from htaccess rules in root folder

I am using below htaccess rules on my website's root folder to remove the files extensions and add trailing slash at the end. However, I'd like to exclude a sub-directory /sub-dir/ from the root folder htaccess rules. I tried to add another htaccess…
Webnerdoz
  • 155
  • 1
  • 6
  • 15