Sorata
Sorata

Reputation: 47

how to 301 example.com/xxx/feed to example.com/xxx/ in htaccess

I need to remove the url's feed by using htaccess.

I use RewriteRule ^[0-9]{4}/[0-9]{1,2}/[^/]+/feed/?$ /[R,L]

But it can't direct the url

http://www.example.com/xxx/feed

to right url

http://www.example.com/xxx/

I don't know too much about htaccess.

If you can tell me how or give me some advice to learn how to do it, it's really thank you for your help.

Just redirect the url:example.com/xxx/feed to example.com/xxx/ in htaccess.

Upvotes: 1

Views: 3112

Answers (1)

anubhava
anubhava

Reputation: 785186

Simplify your rule to this:

RewriteEngine On
RewriteRule ^(.+?)/feed/?$ /$1/ [L,R]

OR using RedirectMatch:

RedirectMatch 302 ^/(.+?)/feed/?$ /$1/

Upvotes: 1

Related Questions