0

Hi we’re using wordpress in apache server.

We want to 301 redirect our specific path with trailing slash to non trailing slash.

Example:

https://www.example.com/action/villa/?city=Ankara&area=etimesgut/

to

https://www.example.com/action/villa/?city=Ankara&area=etimesgut

How can we make that with using htaccess?

I have searched on site but i cant find content redirect urls like that with htaccess.

Thank you for your help

1 Answers1

0

To remove your trailing slash, add this to your .htaccess:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]

Make sure you clear your cache before testing this.

Joe
  • 4,877
  • 5
  • 30
  • 51