JTC
JTC

Reputation: 3464

htaccess delete characters from url and redirect

I want to strip _/ from url.

Example: mysite.com/_/something want to redirect to mysite.com/something

Upvotes: 3

Views: 1907

Answers (2)

Ed-AITpro
Ed-AITpro

Reputation: 340

I assume you just want to do a redirect correct?

RedirectMatch 301 ^/_/$ http://mysite.com/something

If you have Go Daddy hosting then you would have to do this:

/wordpress-testing-website/ is the folder where this testing site exists. The post name is "test_" in this example

RedirectMatch 301 ^/wordpress-testing-website/(.*)_/$ http://www.ait-pro.com/wordpress-testing-website/uncategorized/something/

Upvotes: 0

anubhava
anubhava

Reputation: 785058

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^_/(.*)$ /$1 [L,R=301]

Upvotes: 3

Related Questions