URL Rewriting in WordPress

Your best bet for an easy solution is to actually use the “Custom Structure” option in your WordPress admin under Settings > Permalinks. There are a number of other structure tags you may use as seen in the Codex. If you’re looking for even more customization and manual control, it’s actually a pretty complex topic … Read more

Additional .htaccess rules based on wp page

I’m pretty sure you have wrong “rewrite” parameter in your add_rewrite_rule call. I’m writing it directly in here, so it can be buggy… But it should look something like this: add_rewrite_rule(‘^authors/([^/]*)/([^/]*)/?’,’index.php?page_id=<YOUR AUTHOR PAGE ID>&my_author_name=$matches[1]&my_author_pic=$matches[2]’,’top’); Then you can use add_rewrite_tag (http://codex.wordpress.org/Rewrite_API/add_rewrite_tag) to add your custom query variables (my_author_name and my_author_pic). And in your author page you … Read more

Pagination posts. Url format

Your rewrite rule format is not correct. The $rewrite argument must point to index.php with query vars set so WordPress can create the default query: add_action( ‘init’, ‘wpa103850_init’ ); function wpa103850_init() { add_rewrite_rule( ‘^([^/]+)([0-9]{1,2}).htm$’, ‘index.php?name=$matches[1]&page=$matches[2]’, ‘top’ ); } However, this will still not work correctly, due to the canonical redirect. WordPress wants to enforce a … Read more

Difference in Get Variable Location

There is no “normal” way (either is commonplace), but it all comes down to your permalink structure, and whether that has a trailing slash or not. As for your login page, it all depends on how you’re generating the URLs, but I would suggest using user_trailingslashit( $basepath_without_query ). As the name suggests, it will apply … Read more

Getting URL Variables with a Rewritten Page (Login Page)

If you want instead of redirect to wp-login the user redirect to login page then use the following code. It will redirect user to login page where login form is present. add_filter(‘site_url’, ‘wplogin_filter’, 10, 3); function wplogin_filter( $url, $path, $orig_scheme ){ $old = array( “/(wp-login\.php)/”); $new = array( “login/”); return preg_replace( $old, $new, $url, 1); … Read more