Questions tagged [trailing-slash]

A slash sign at the end of a URL.

A slash sign at the end of a URL.

263 questions
0
votes
1 answer

WP rocket prevent 301 redirect to URL with trailing slash

When user access to my website with url: example.com/post-name Wordpress should perform 301 redirect to: example.com/post-name/ But it's not working due the WP Rocket caching plugin (I couldn't find out why this is happening, but WP rocket is…
bagli
  • 34
  • 4
0
votes
1 answer

.htaccess force trailing slash

I've been trying to solve this for some time, and have tried a few suggestions which I found, but none of them seem to work I would like to try and force a slash at the end of the URL for any page visited on my site, so rather…
user17897704
0
votes
0 answers

Nginx ingress controller rule to add a trailing slash to url without redirect

The main problem client hasn't support redirection and can't generate URLs with trailing slash. The backend uses openAPI and supports URLs only with a trailing slash. I am and kubernetes ingress in the middle. I can't change client or backend. I am…
user16628008
0
votes
0 answers

Problem Trailing Slash Wordpress multisite

When we generate SEO reports, the SEO crawler detects some pages as having the trailing slash and others not, but only on some of our pages. All our pages have a trailing slash. But we don't understand why 301 redirects are done on the one that…
0
votes
1 answer

Redirect homepage to homepage with trailing slash wordpress

Hello I am trying to have the redirection done from domain.com -> domain.com/ Is there a way to accomplish this in Wordpress. I've been trying with htaccess, but httpstatus.io keeps showing 200, when actually it should show a 301 redirect. It is…
Albert S.
  • 93
  • 2
  • 10
0
votes
1 answer

.htaccess is not executed when trailing slash is missing

This is the weirdest problem I have encountered. I am using mod_rewrite in .htaccess in Apache/2.2.13 (Linux/SUSE), and it appears to not be called when there is no trailing slash in the URL. I tested by putting garbage in the .htaccess file, and…
0
votes
1 answer

Why does Apache throw a Forbidden error when using RewriteRule and going to an URL with a trailing slash at its end?

I want to build a search page for my application, and I am using .htaccess to make URLs look better. The search page is located at localhost/search. Furthermore, two optional parameters can be appended at the end of the URL, like this:…
Looky1173
  • 440
  • 6
  • 17
0
votes
1 answer

Spring MVC configuration breaks Tomcat's trailing slash mapping

Under Tomcat 9 src/main/webapp folder, I created a sub-folder named app containing an index.jsp file. If I request localhost:8080/app I get a 404 error, while with a trailing slash localhost:8080/app/ it works fine.If I disable spring mvc the…
lainatnavi
  • 1,453
  • 1
  • 14
  • 22
0
votes
1 answer

Keep trailing slash in route with default parameter in Symfony 5.1

Symfony 5.1 I'm updating some legacy code and I need the following routes to match: /article/ <--- matches default page 1 and has trailing slash /article/2 <--- matches pages 2 through n with no trailing slash If I use the route annotation... *…
hipnosis
  • 618
  • 1
  • 8
  • 13
0
votes
0 answers

Remove trailing slash from filename extensions in htaccess

I am using the following entry in .htaccess to add the trailing slash with the condition of !-f, which should add the trailing slash when it is not a valid file: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*[^/])$ /$1/ [L,R] Now actually I…
Franky2207
  • 163
  • 2
  • 19
0
votes
0 answers

How to add Trailing Slash at the end of directory ONLY

How to add Trailing Slash at the end of directory only, not file? example: with Trailing Slash: https://www.mywebsite.com/directory/ example: without Trailing Slash: https://www.mywebsite.com/file.php
Amin
  • 59
  • 1
  • 5
0
votes
1 answer

mod_rewrite, trailing slash removal, and current directory

I've perused the related questions, but I cant figure this little caveat out. The golden rule I've seen tossed around for trailing slash removal via mod_rewrite is: RewriteRule ^(.*)/$ /$1 [R,L]. This is all fine and good, but it strips off the…
Dan Lugg
  • 20,192
  • 19
  • 110
  • 174
0
votes
1 answer

How do I return location.hostname without the trailing slash?

How do I return the string example.com using JavaScript if the input is https://example.com/page.html?query=string? Right now, if I use window.location.hostname – or location.hostname – the return value isexample.com/, but I wantexample.com, without…
0
votes
2 answers

Putting Slash / in the URL in Codeigniter breaks the page style/images etc

My website is working fine. All controllers works fine unless I put a slash at the end the pages broke. Here is oringal URL: Saaf.Pk But when I put a slash at the end, style & images broked: Here I know the problem is that URL path got changed. But…
0
votes
1 answer

Remove trailing slash for nginx WordPress multisite

I have installed WordPress multisite in sub-directory abc.com/en/. I want to remove the trailing slash for SEO purposes. So pages like abc.com/en/xxx/ will be 301 redirected to abc.com/en/xxx without a trailing slash. After checking many resources…
4440
  • 1
  • 1