Forum Moderators: phranque
My blog (Dotclear platform) URLs stand like this for now :
http://www.example.com/blogstory/?2008/03/12/707-montreal-dans-sa-bulle-hivernale
but I would like URLs like this :
http://www.example.com/blogstory/2008/03/12/707-montreal-dans-sa-bulle-hivernale
OR like this :
http://www.example.com/blogstory/montreal-dans-sa-bulle-hivernale
I would like to know both rules but I will use only one.
Tanks a lot for your time.
Frank
[edited by: jdMorgan at 9:30 pm (utc) on Mar. 17, 2008]
[edit reason] No personal URLs, please. See Terms of Service. [/edit]
The rewrite rule then connects that URL with the correct internal server path and filename.
You'll also need a redirect from the old URL to the new URL to stop the unwanted URL being indexed as Duplicate Content.
You must also validate the keyword-text part of the URL against your database post title entries to stop people assigning any old title they want, in external links, and ruining your indexing.
www.example.com/blogstory/2008/03/12/707-montreal-dans-sa-bulle-hivernale
...where the date and the "707" are used to pull the required data from the database, but the following words are just keywords to stuff the URL.
If the blog script does not compare those words with the real title of the post, then I can link to your article as...
www.example.com/blogstory/2008/03/12/707-this-article-is-complete-junk
...and the article will be indexed with that URL too. That's Duplicate Content and will be a big problem for you.
Imagine someone "created" 50 URLs for every page of your site in this way. See the problem yet?
Validate the words in the request, and send a 404 or a 301 if they do not match.
imagine this is my 707e post :
www.example.com/blogstory/2008/03/12/707-this-article-is-complete-junk
and this is the 708e post :
www.example.com/blogstory/2008/03/12/708-this-article-is-complete-junk
My rule :
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /blogstory/index.php/$1
RewriteRule ^index.php$ blogstory/index.php/
RewriteCond %{QUERY_STRING} ^type=co$
RewriteRule ^rss\.php$ blogstory [NC,L,R=301]
RewriteRule ^atom\.php$ blogstory [NC,L,R=301]
RewriteRule ^atom\.php blogstory [NC,L,R=301]
RewriteRule ^rss\.php blogstory [NC,L,R=301]
# Permit rewriting of index.php?/year/month/day/uniquenumber-post-title for dotclear1
RewriteCond %{QUERY_STRING} ^([0-9]{4}/[0-9]{2}/[0-9]{2}/[0-9]+.*)$
RewriteRule ^index.php [exemple.com...] [R,L]