Problem with ErrorDocument and Pretty URLs

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
seregarem
Forum Members
Forum Members
Posts: 200
Joined: Sat Aug 28, 2010 1:03 pm

Problem with ErrorDocument and Pretty URLs

Post 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?
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Problem with ErrorDocument and Pretty URLs

Post by Rolf »

why not use the cmsms default 404 contenttype?
http://docs.cmsmadesimple.org/configura ... rror-pages
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
seregarem
Forum Members
Forum Members
Posts: 200
Joined: Sat Aug 28, 2010 1:03 pm

Re: Problem with ErrorDocument and Pretty URLs

Post by seregarem »

My client asked me to send a visitor to the home page...
seregarem
Forum Members
Forum Members
Posts: 200
Joined: Sat Aug 28, 2010 1:03 pm

Re: Problem with ErrorDocument and Pretty URLs

Post by seregarem »

Please help!!!
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1974
Joined: Mon Jan 29, 2007 4:47 pm

Re: Problem with ErrorDocument and Pretty URLs

Post 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...
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Post Reply

Return to “The Lounge”