How can i maintain permalink structure and avoid a 404 error when loading external content?

You could use a WordPress rewrite (as opposed to mod-rewrite) to solve the issue. function createRewriteRules( $rules ){ $newrules = null; $newrules = array(); $newrules[“catalog/?$”] = “index.php?page=xx”; $rules = $newrules + $rules; return $rules; } add_action(‘rewrite_rules_array’, ‘createRewriteRules’); You’ll need to flush the rules: http://codex.wordpress.org/Function_Reference/flush_rewrite_rules Your page-catalog.php file could then sniff the original url and do … Read more

Rename page URL

I have tried some add_rewrite_rule magic and query variables and it worked. Thanks for the help everyone. If in case anyone want to refer the answer: add_filter( ‘query_vars’, ‘wpse26388_query_vars’ ); function wpse26388_query_vars( $query_vars ){ $query_vars[] = ‘custom_gallery_id’; return $query_vars; } add_rewrite_rule( ‘topic/([^/]+)/([^/]+)/gallery/([0-9]+)/?$’, ‘index.php?pagename=gallery&custom_gallery_id=$matches[3]’, ‘top’ ); I was able to solve my problem with this.

Two Rewrite Rules

Catch those requests before WordPress can see them: RewriteEngine On RewriteBase / RewriteRule ^link/(\d+)$ /links/index.php?link=$1 [L,QSA] Place the WordPress rules below the link rules.

Rewrite function

Go to Settings->Permalinks Add this to Custom Structure: /%postname%/ Update WordPress generates .htaccess-files for this. Just go to your root and activate the show invisable files on your computer. Here is the htaccess for the structure: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d … Read more

URL Variables in a Certain Page

Try this code: add_filter( ‘query_vars’, ‘my_query_vars’ ); function my_query_vars( $vars ) { $vars[] = ‘catname’; return $vars; } add_action( ‘generate_rewrite_rules’, ‘my_rewrite_rules’ ); function my_rewrite_rules( $wp_rewrite ) { $products_page_id = 1; //your product’s page ID $wp_rewrite->rules = array( ‘products/?([0-9]{1,})/?$’ => $wp_rewrite->index . ‘?page_id=’.$products_page_id.’&paged=’ . $wp_rewrite->preg_index( 1 ), ‘products/(.+?)/?([0-9]{1,})/?$’ => $wp_rewrite->index . ‘?page_id=’.$products_page_id.’&catname=”.$wp_rewrite->preg_index( 1 ).”&paged=’ . $wp_rewrite->preg_index( … Read more