I'm a newbie in Drupal 8, Somehow, in my website, there is redirection due to double ‘/’ in the URLs, an example from

http://example.com//article/slug

redirect 302 to

http://example.com/article/slug

Is it possible to make it 301 redirect so it is beneficial to show Google? I have tried using .htaccess (like .htaccess remove double slash from URL or Issue In Removing Double Or More Slashes From URL By .htaccess) but nothing work, still using 302 redirect, also if I using the Redirect module, it cannot use double slash '/'
I need to redirect 301 (Permanent redirect) so it will work for my SEO

Note: double slash shows because I'm using url('') + alias url in my template, I didn't notice that it make double slash because it was redirect successfully to my article, but for SEO Google, it was big mistake, so I'm hope if there are any solution? such as make url with double slash as not found or make it to 301 redirect for fixing my SEO.

  • Welcome to Drupal Answers! We love to help you but .htaccess redirects are a bit off-topic here. The question actually should be "How to strip that double slash from my URL slug". That looks like sth. custom. You should fix that. You should tell us how it got there and maybe show us the suspicious code snippet that did that (if any). – leymannx Nov 8 at 8:39
  • Thanks @leymannx , double slash show because I'm using url('<front>') + alias url in my template, I didn't notice that it make double slash because it was redirect successfully to my article, but for SEO Google, it was big mistake, so I'm hope if there are any solution? such as make url with double slash as not found or make it to 301 redirect for fixing my SEO – sidikidis Nov 8 at 8:46
  • So you actually already fixed the double slash issue and now are left to provide some redirect for all faulty URLs that already got indexed, is it that? – leymannx Nov 8 at 9:06
  • Yes @leymannx, I already fixed it, Now are left to provide some redirect for all faulty URLs that already got indexed, is there any idea? – sidikidis Nov 8 at 9:24
  • But why not simply removing the double slashes from the slug and therefore redirect to the right URL? Like in .htaccess remove double slash from URL or Issue In Removing Double Or More Slashes From URL By .htaccess? – leymannx Nov 8 at 9:28

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.