Page 1 of 1

Problem with ErrorDocument and Pretty URLs

Posted: Sat Dec 01, 2012 1:29 pm
by seregarem
I have such a .htaccess file:

Code: Select all

ErrorDocument 404 /

Options +FollowSymLinks
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_METHOD} !POST$
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

RewriteCond %{HTTP_HOST} ^www.http://dkr-zakaz.ru/(.*)
RewriteRule ^(.*)$ http://dkr-zakaz.ru//$1 [R=301,L]

RewriteCond %{QUERY_STRING} opl.html
RewriteRule ^(.*)$ /kak-oplatit.html? [R=301,L]

RewriteCond %{QUERY_STRING} sovet.html
RewriteRule ^(.*)$ /articles.html? [R=301,L]

RewriteCond %{QUERY_STRING} otzuv.html
RewriteRule ^(.*)$ /otzyvy.html? [R=301,L]

RewriteCond %{QUERY_STRING} order.php
RewriteRule ^(.*)$ /zakazat-rabotu-sejchas.html? [R=301,L]

RewriteCond %{QUERY_STRING} novost.html
RewriteRule ^(.*)$ /vakansii.html? [R=301,L]

RewriteCond %{QUERY_STRING} o-mba-m.html
RewriteRule ^(.*)$ /news/9/61/MBA-i-EMBA/d,diploma.html? [R=301,L]

RewriteCond %{QUERY_STRING} o-4.html
RewriteRule ^(.*)$ /news/8/61/yurisprudentsiya-pravo-psihologiya-pedagogika-istoriya-literatura/d,diploma.html? [R=301,L]

RewriteCond %{QUERY_STRING} o-3.html
RewriteRule ^(.*)$ /news/7/61/ekonomicheskie-nauki/d,diploma.html? [R=301,L]

RewriteCond %{QUERY_STRING} o.html
RewriteRule ^(.*)$ /otchet-po-praktike-na-zakaz.html? [R=301,L]

RewriteCond %{QUERY_STRING} n.html
RewriteRule ^(.*)$ /nabor-i-oformlenie-rabot.html? [R=301,L]

RewriteCond %{QUERY_STRING} sov6.html
RewriteRule ^(.*)$ /news/4/61/chto-schitat-plagiatom-pri-napisanii-kursovoj-ili-diplomnoj-raboty.html? [R=301,L]

RewriteCond %{QUERY_STRING} kupim.html
RewriteRule ^(.*)$ /sistema-skidok-bonusov.html? [R=301,L]

RewriteCond %{QUERY_STRING} index.php?Itemid=&id=40&option=com_content&task=view
RewriteRule ^(.*)$ /home/diplom-uroven-slozhnyj.html? [R=301,L]

RewriteCond %{QUERY_STRING} index.php?Itemid=&id=41&option=com_content&task=view
RewriteRule ^(.*)$ /home/diplom-uroven-srednij.html? [R=301,L]

RewriteCond %{QUERY_STRING} index.php?Itemid=&id=42&option=com_content&task=view
RewriteRule ^(.*)$ /home/diplom-uroven-legkij.html? [R=301,L]

RewriteCond %{QUERY_STRING} doc.html
RewriteRule ^(.*)$ http://dkr-zakaz.ru/? [R=301,L]

RewriteCond %{QUERY_STRING} cat-80.html
RewriteRule ^(.*)$ http://dkr-zakaz.ru/? [R=301,L]

RewriteCond %{QUERY_STRING} cat-850.html
RewriteRule ^(.*)$ http://dkr-zakaz.ru/? [R=301,L]
But if I go to a bad link (http://dkr-zakaz.ru/doc111.html), there is a message: The requested URL was not found on this server.
If I delete RewriteRule ^(.+)$ index.php?page=$1 [QSA] then after going to a bad link (http://dkr-zakaz.ru/doc111.html), it redirects me to the right page (home page). What's wrong? Help, please!

P.S. Sometimes when I' going to, for example, http://dkr-zakaz.ru/news/7/61/ekonomich ... ploma.html a browser write: The requested URL was not found on this server. When I update page hierarchy positions, it redirect to the right page. What's wrong?

Re: Problem with ErrorDocument and Pretty URLs

Posted: Sat Dec 01, 2012 1:52 pm
by Rolf
why not use the cmsms default 404 contenttype?
http://docs.cmsmadesimple.org/configura ... rror-pages

Re: Problem with ErrorDocument and Pretty URLs

Posted: Sat Dec 01, 2012 3:54 pm
by seregarem
My client asked me to send a visitor to the home page...

Re: Problem with ErrorDocument and Pretty URLs

Posted: Sun Dec 02, 2012 12:59 pm
by seregarem
Please help!!!

Re: Problem with ErrorDocument and Pretty URLs

Posted: Sun Dec 02, 2012 1:29 pm
by Jo Morg
The easy way: insert this on the custom 404 page {redirect_page page='home'}... However 404 pages have their purpose (every error page has...) and I'm not sure if redirecting to home is good practice, nor do I think it's good for SEO purposes...
There are other ways... but all sums up to good practice and SEO...