Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

rewrite WordPress

  • SOLVED

is possible to have a permalink
www.sitename.it / id / www.kijiji.com without point changes with the -

regards cristian

Answers (4)

2011-09-10

Jurre Hanema answers:

Try dropping this into your functions.php:


remove_filter( 'sanitize_title', 'sanitize_title_with_dashes');
add_filter('sanitize_title', 'wpq_sanitize_title');

function wpq_sanitize_title($title)
{
$title = strip_tags($title);
// Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet.
$title = str_replace('%', '', $title);
// Restore octets.
$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);

if (seems_utf8($title)) {
if (function_exists('mb_strtolower')) {
$title = mb_strtolower($title, 'UTF-8');
}
$title = utf8_uri_encode($title, 200);
}

$title = strtolower($title);
$title = preg_replace('/&.+?;/', '', $title); // kill entities
$title = preg_replace('/[^%a-z0-9 ._-]/', '', $title);
$title = preg_replace('/\s+/', '-', $title);
$title = preg_replace('|-+|', '-', $title);
$title = trim($title, '-');

return $title;
}


This allows points in the post name and takes effect on all newly published posts.

2011-09-10

Kannan C answers:


/%post_id%/www.kijiji.com

This will work only for posts


crisdany6 comments:

I try to be more clear

if the title and "www.kijiji.it and a classifieds website"
must be
www.sitename.it / 4 / www.kijiji.com-and-a-classifieds-website
changing RewriteRule...

2011-09-10

MDan answers:

You can try add this rewrite rule to your .htaccess file:

RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_URI} !..+$
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1/ [R=301,L,QSA]


You should backup your current .htaccess file before!

Additionaly you should read this post:
http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/

2011-09-12

ej_emman answers:

hello crisdany6,

It was not really clear for me, of what you really want to happen but I get some Idea on you second demotion.
Maybe you just need this. placing it to your permalink custom structure.

/%post_id%/%postname%/