Is it possible to rewrite URLs in this situation?

I think you are on the right track with .htaccess and rewrite rules What you might consider is a 301 redirect in your .htaccess like this #fancy name redirect here redirectMatch 301 ^/restaurant/london(.*)$ /?category_name=restaurants&locations=london Basically you can then tell people to go to your own friendly URL and they get redirected to the longer one … Read more

Rewriting URLs in WordPress

‘event/industry/(.+)/?$’ The above is the URL that will be rewritten behind the scenes. The brackets create what is known as a “backreference”. ‘index.php?post_type=eg_event&industry=’ . $wp_rewrite->preg_index(1) The above is the actual URL that will be served to the browser. So, http://yourdomain.com/event/industry/abc/ matches the rule “event/industry/(.+)/?$”. The term ‘abc’ becomes a backreference with index 1, because it … Read more

Use single-site install and map entities to subdomains

I hope you are still interested in this question. I did a sub domain mapping to a custom post type using custom .htaccess setting. RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} ^(.+)\.domain-name\.com$ RewriteRule ^$ /index.php?store=%1 [L] Using this setting, each sub domain will map to the store custom post type. http://apple.domain-name.com will be equal to http://domain-name.com?store=apple or … Read more

Get the category is not working on url

I solved this problem using wp_get_object_terms, probably not the cleanest way but it does what I wanted. For those of you having the same problem, this is how my final product looks: function custom_permalink( $post_link, $id = 0, $leavename ) { global $wp_rewrite; $post = &get_post( $id ); if ( is_wp_error( $post ) || $post->post_type … Read more

Rewrite URL – insert custom variables as a directory path

I think you wanna do something like this: add_action(‘init’, ‘my_rewrite’); function my_rewrite() { global $wp_rewrite; // Your desired structure $permalink_structure=”/prodotti/%my_custom_variable%/%postname%/” // add the custom variable to wp_rewrite tags $wp_rewrite->add_rewrite_tag(“%my_custom_variable%”, ‘([^/]+)’, “my_custom_variable=”); // Here you need to know the name of the custom post type you want the permalink structure to be used on $wp_rewrite->add_permastruct(‘custom_post_type_name’, $permalink_structure, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)