0

is there any way to remove some pattern from url?

For exampple this is my pattern -=-something_dynamic-=- and here is my url

_http://mysite.com/category/-=-something_dynamic-=-subcategory/

that I wish to become

_http://mysite.com/category/subcategory/
0

1 Answer 1

1

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 ^(category)/.*?(subcategory)/?$ /$1/$2/ [L,NC,NE,R=301]
Sign up to request clarification or add additional context in comments.

1 Comment

I think the point is that something_dynamic must be dynamically matched, rather than statically in the RewriteRule.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.