12

When you register your post type, the with_front argument of rewrite should be false, so the permastruct is not appended to the front of your custom post type permalink. $args = array( // snip... 'rewrite' => array( 'with_front' => false ), // snip... ); register_post_type( 'your-post-type', $args );


10

Another way to do it: add_action('init', function() { add_rewrite_rule( '^properties/([0-9]+)/?', 'index.php?pagename=properties&property_id=$matches[1]', 'top' ); }, 10, 0); add_action('init', function() { add_rewrite_tag( '%property_id%', '([^&]+)' ); }, 10, 0); Codex Rewrite API/add rewrite ...


8

You'll find this post by Joost De Valk on changing WordPress permalinks to only include /%postname% very helpful. How many posts you have doesn't matter anymore if you are using the latest version of WordPress (at least > v3.3.1). I believe your permalink structure initially was — this /blog/%year%/%monthnum%/%day%/%postname%/ — and now, you are planning ...


3

The best way to accomplish this is remove the default sanitize_title filter and replace it with yours, which will encode those characters properly. Here is an implementation of using accents in permalinks. Example: remove_filter( 'sanitize_title', 'sanitize_title_with_dashes'); add_filter( 'sanitize_title', 'restore_raw_title', 9, 3 ); function ...


2

You should look at "Rewrite Endpoints", which are much simpler to work with than custom rewrites. And they fit your use case perfectly: http://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint You might add your "show" endpoint like so: function wpsx_37961_add_endpoints() { // Add the "show" rewrite endpoint to all URLs add_rewrite_endpoint('...


2

Alternatively you can add the following line of code to your functions.php file: add_filter( 'got_rewrite', '__return_true', 999 ); We're doing this to make WordPress play well with nginx.


2

A quick fix could be to change the permissions on your .htaccess file so if you change settings in Wordpress, it'll show you what you need to manually change your .htaccess to since it won't have direct write access to the file anymore.


2

I did not test this, but this should do what you want. Put the following in your functions.php: add_filter('rewrite_rules_array', 'new_category_name_rewrite_rule'); function new_category_name_rewrite_rule($rules) { $new_rules = array(); $categories = get_categories(); foreach ($categories as $category) { $cat_name = preg_replace('#\s+#', ...


2

This should cover everything: function wpa_rewite_translate(){ global $wp_rewrite; $wp_rewrite->pagination_base = 'pagina'; $wp_rewrite->author_base = 'autor'; $wp_rewrite->comments_base = 'comentarios'; $wp_rewrite->feed_base = 'alimentar'; $wp_rewrite->search_base = 'busqueda'; $wp_rewrite->...


2

You can add a RewriteRule to your .htaccess to instruct mod_rewrite to stop processing any URI that begins with Staff/ or resolves to Staff: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteRule ^/?Staff(/|$) - [END,NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-...


2

This will allow you to use the post name without the slug. Essentially anytime the link is requested it can be altered to exclude the base post type. And any time a query runs with just a name, the available post types used in the search are altered to include your post type. function wpse_remove_cpt_slug( $post_link, $post, $leavename ) { // leave ...


2

You are using Cloudfront in front of S3, so in order to mix in 2 sources of content you need to on your blog.mycompany.com - add rewrites of blog/* -> /* so that your blog can handle blog.mycompany.com/blog/ urls well. add new blog.mycompany.com as an Origin in "Origins and Origin Groups" tab. add new "Behavior" for /blog* path pattern and point it to your ...


2

I want to remove all instances on aff=x regardless of how many other parameters in the URL. Assuming you want to keep any other URL parameters (in any order) and simply remove the aff=number parameter, then you can do something like the following using mod_rewrite in the root .htaccess file: RewriteCond %{QUERY_STRING} ^(.*&|)aff=\d+(?:&(.*)|)$ ...


2

Thanks to Tom, I looked more carefully to the plugins. And I can confirm that the problem is NOT RELATED to mod_rewrite, but to a plugin conflict. (sorry that I posted such a suspicion, but I read somewhere a very similar problem that was explained like that.) Deactivating plugin by plugin, I found that one you made this behaviour. Still no clue why, but ...


2

You can actually change them in Settings -> Permalinks and it will change the link that generated for the post. And if you still be unhappy with result you can remove WordPress rewrite rules for dates with date_rewrite_rules filter. UPDATE: In this case, you can use post_rewrite_rules to keep the date to post rule working and implement redirect during ...


2

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php [L] # If images not found on development site, load from production RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$ RewriteRule ^(.*)$ https://www.example.com/$1 [QSA,L] The problem here is that "If images not found on development site" then the ...


1

I apologize this should be a comment. You have to ask yourself if its necessary. I know your asking here for advice, but is your website currently under performing? Is it slow? Are users complaining? I personally wouldn't recommend FastCGI but there are various other plugins or tools to speed up your website. I would recommend the following plugins: WP ...


1

I am by no means a mod_rewrite expert but would something like this work? <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Force HTTPS for /cart/ RewriteCond %{HTTPS} !=on RewriteCond %{THE_REQUEST} ^[A-Z]+\s/cart [NC] RewriteRule ^(cart) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L] # Force HTTPS for /my-account/ RewriteCond %{HTTPS} !=...


1

Not sure if I understood you right, but there's an option when registering the custom post type: register_post_type( 'your_cpt_name', array( 'rewrite' => array( 'with_front' => true ) ) );


1

Something as simple as phpinfo(); will tell you a lot about the differences in the server configurations. I'd start there.


1

Redirection allows you to modify post slugs and keeps a history of them, pointing all requests for the history of a page to the same destination. It's useful for all sorts of other things too, but it will definitely solve this problem.


1

This is currently not possible for a multisite setup. It should be possible in WordPress 3.5 which is planned to be released next month. So your only solution is: wait. Update December 26: This is now possible in WordPress 3.5 without further hacks. :)


1

If you don't want Wordpress to overwrite your changes in .htaccess file, then make sure that you write your changes outside of the Wordpress comment block, that is, either before or after this: # BEGIN WordPress ... # END WordPress Think of this area as Wordpress' territory. Anything within this block, will be overwritten by Wordpress once it has to make ...


1

This is fairly easy to set up using virtual host configurations in Apache or Nginx (depending on which webserver you want to run on your box). Here's the gist of things: 1. Each installation will have a separate database and separate database user (for security). I set these up manually in MySQL through the command line, but if you have phpMyAdmin set up, ...


1

Problem 1 Your hook ci_add_rules() will still run when you flush rules, so remove it first (and avoid "unsetting" non_wp_rules, you'll break other plugins that make use of it). function ci_remove_rules() { remove_action( 'generate_rewrite_rules', 'ci_add_rules' ); $GLOBALS['wp_rewrite']->flush_rules(); } Problem 2 Pretty sure you want: ...


1

Its not good way to edit .htaccess for wordpress url rewriting (only for main urls settings from admin panel) You found your response here : API basic url rewriting or The Rewrite API: Post Types & Taxonomies An example : add_action( 'init', 'rewrite_rule' ); function rewrite_rule() { global $wp,$wp_rewrite; // Remember to flush the rules once ...


1

RewriteRule (.*)(å|ä)(.*) $1a$3 [R=302,L] RewriteRule (.*)(ö)(.*) $1a$3 [R=302,L]


1

You have to use a redirect not just a rewrite: ^dashboard(.*) wp-admin$1 [L,R=301] WordPress is using a hard coded search for wp-admin in the request URI.


1

# Only allow access to this directory if they are coming from your domain; excluding you, your server, Google and any other IPs RewriteEngine On RewriteCond %{REMOTE_ADDR} !^(xxx\.xxx\.xxx\.xxx|xxx\.xxx\xxx\.xxx|66\.249\.) RewriteCond %{HTTP_HOST} !^(127\.0\.0\.0|localhost) [NC] RewriteCond %{HTTP_REFERER} !^https?://(.+\.)?yourdomain\.com/ [NC] RewriteRule ....


Only top voted, non community-wiki answers of a minimum length are eligible