Vinie
Vinie

Reputation: 2993

redirect url to another url using htaccess

I have an url http://example.com/xyz/, and i want this url as http://example.com/xyz xyz is only for example it could be anything. Please help me. your help would be appreciated. Thank you in advance.

Upvotes: 1

Views: 34

Answers (1)

anubhava
anubhava

Reputation: 786261

To remove trailing slash you can use this rule as your first rule:

RewriteEngine On

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

Upvotes: 1

Related Questions