htaccess mod_rewrite not working

With some help (also asked on SO, as this wasn’t a strict WP question), and some testing, the following ended up working for me (added a slash just before the $ sign): RewriteRule ^galleries/(.*)/$ /portfolio/$1 [R=301,NC,L] As the galleries are actual directories, not files, they have a slash at the end: http://subdomain.example.com/galleries/headshots/ Here —^

htaccess and redirect to new url using regex

Found that solution useful I think, this is an expensive way to replace underscores with dashes. But this works at least in my test environment. The first rule replaces dashes one by one. The second rule then removes the prefix from the requested URL. RewriteBase / # replace underscores with dashes RewriteRule (.+?)_(.+) $1-$2 [R=302,L] … Read more

Hide category name using mod_rewrite

I solved my problem. All I needed was the WordPress Rewrite API. if( ! function_exists(‘theme_add_rewrite_rules’) ){ function theme_add_rewrite_rules(){ add_rewrite_rule( ‘^blog/([^/]+)/?$’, ‘index.php?name=$matches[1]’, ‘top’ ); } } add_action( ‘init’, ‘theme_add_rewrite_rules’); This solves how wordpress will parse the URL. Half of the problem is how to modify the posts so that the links will not include the /en/ … Read more