How to change page URLs to “www.site.com/page” instead of “example.com/blog/page” but keep post URLs as “example.com/blog/post”?

You just set the WordPress directory in your WP General Settings to your top-level URL (www.site.com/), then copy index.php to the root directory of your site and modify it to load content from your actual wp directory. Step by step instructions are here: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory I did this for my personal web site: http://dannythorpe.com. The WP … Read more

Search url wp-rewrite after redirect?

Fatih, Use str_replace for Turkish chars issue. Change code like this; /* Plugin Name: Redirect Search Results Author: Abdussamad Plugin URI: http://wordpress.stackexchange.com/questions/70740/search-url-wp-rewrite-after-redirect */ class redirect_search_results { function __construct() { add_action( ‘init’, array( $this, ‘redirect’ ) ); } function redirect() { if( isset( $_GET[ ‘s’ ] ) ) { $turkish= array(“İ”,”ı”,”Ü”,”ü”,”Ö”,”ö”,”ğ”,”Ğ”,”ş”,”Ş”); $nturkish = array(“i”,”i”,”U”,”u”,”O”,”o”,”g”,”Ğ”,”s”,”S”); $quest = … Read more

remove post-name from title in custom post type

Fixing the 404 error So it’s because of the ([^&]+) in your add_rewrite_tag() calls: $wp_rewrite->add_rewrite_tag(‘%reference%’, ‘([^&]+)’, ‘reference=”); //$wp_rewrite->add_rewrite_tag(“%location%’, ‘([^&]+)’, ‘location=’); To fix the error, you should use ([^/]+) and not ([^&]+). I also intentionally commented out the second line because if the taxonomy’s slug is location, then WordPress should have already added the %location% rewrite … Read more

custom naming of search permalink /search/

The reason it isn’t working is because you haven’t told WordPress how to handle that page. You can do so by applying a rewrite rule in the following manner. add_action( ‘init’, ‘wpse_63716_search_rule’ ); function wpse_63716_search_rule(){ add_rewrite_rule(‘^suche/([^/]*)?’, ‘index.php?s=$matches[1]’, ‘top’); } Don’t forget to flush the permalinks after adding the above code.

Custom post type category, taxonomy and URL rewrite problem

Welcome to WPSE. That can be solved pretty straight forward. Register a custom post type products Register two taxonomies (brands and functionalities) for your custom post type Feed WordPress the correct template, following the template hierarchy and WordPress standard Flush your rewrite rules (can’t be skipped, but is easy) Step 1 Register your custom post … Read more

Tricky URL rewrite with custom values in url

As I mentioned in your other question, you don’t want to be touching the .htaccess file, you need an internal rewrite. So, given the URL: http://mysite.com/image/wp_username/3digitnumber we need to add the following rule to handle it: // set up the rewrite rule function wpa73374_setup_rewrites(){ add_rewrite_rule( ‘image/([^/]+)/([0-9]+)/?$’, ‘index.php?pagename=custompage&iuser=$matches[1]&iname=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘wpa73374_setup_rewrites’ ); Note … Read more

Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?

You can use add_rewrite_rule hooked to the init action, instead of using the generate_rewrite_rules filter (where it gets a bit low-level). But the actual problem with your rewrite rules is the regex in place. Here’s what it’d look like: function wtnerd_edition_specific_categories() { add_rewrite_rule( ‘(.+?)/channel/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$’, ‘index.php?category_name=$matches[1]&channel=$matches[2]&feed=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘(.+?)/channel/(.+?)/(feed|rdf|rss|rss2|atom)/?$’, ‘index.php?category_name=$matches[1]&channel=$matches[2]&feed=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘(.+?)/channel/(.+?)/page/?([0-9]{1,})/?$’, ‘index.php?category_name=$matches[1]&channel=$matches[2]&paged=$matches[3]’, … Read more

How to properly prefix blog post URL’s

Assuming that you are not using a plugin to handle your post types but are registering them manually: Add the rewrite argument to your register_post_type() function calls. $rewrite = array( ‘slug’ => $slug, ‘with_front’ => false ); $args = array( // your other arguments ‘rewrite’ => $rewrite ); register_post_type( ‘name_of_your_post_type’, $args ); If your registering … Read more