Spider friendly Pages

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
Jan212
Posts: 859
Joined: Wed 28. Jan 2004, 21:38
Location: Solingen
Contact:

Spider friendly Pages

Post by Jan212 »

Hello everbody,
this is no bugfix, my solution is hardcoded but is working as well...
The rewrite function isn't working with the alias function at the time, but this simple script will cause the same effect.
Enable the rewrite engine in includes/inc_conf/config.inc.php...
This hack is only concepted for better indexing of the main categories, but with a little bit of work it can be used for the whole system...
Add In your .htacces

Code: Select all

RewriteEngine On
RewriteBase /phpwcms_1.1/ 
RewriteRule ^anfragen.html$ index.php?id=1
RewriteRule ^([a-z]*)\.html$ index.php?id=$1
RewriteRule ^(.*)\.html$ index.php?id=$1
Code expl.
Line1: to enable mod_rewrite -
check it in your phpinfo under -> apache if it is enabled, otherwise go to your apache/conf/httpd.conf an enable it.

Line 2: the base of the files that have to be rewritten -
example: in case of http://myhost.de/phpwcms_1.1/ the RewriteBase is /phpwcms_1.1/

Line3
^ = Beginning of the loop
anfragen.html = the name of the file which you want to create
$ = End of the loop
index.php?id=1 = the ID of the categorie/article you want to rename- if you want to rename an article fill in this index.php?id=1,1,0,0,1,0 for example

Line4&5
These rules must be set to create files like 1.12.1.0.1.1.html.
I will use it for the news etc.
Please make sure that your indication classes(zeichenklassen)are set correctly.

In includes/inc_front/front.func.inc.php
replace your code with this...

Code: Select all

//Rewrite functions

function url_search($query)   
{ 
   if(strpos($query, "id")) $noid = substr($query, "4");
   else $noid = substr($query, "1");
   $file = str_replace(",", ".", $noid).".html"; //further use 
   //$file = $noid.".html"; 
   $link = "<a href=\"".$file."\""; 
   return($link); 
  //unset($link); 
}
You can also use [ID alias]string[/ID], the url will be transfered correct into ya browser, but the content is only shown if you define the rewrite rule in ya .htaccess...

That's all - best regards

A yockl from the deepest backwood of germany
Regards/ Grüsse/ Groetjes - JAN212
------------------------------------------------
null212 - Büro für Kommunikation und Design
------------------------------------------------
Lyrikfetzen des Tages
1. Ist der Quelltext auch valide fragt Herr Müller ganz perfide.
2. Wat is dat een lekker ding.
3. Wer Vision hat soll zum Arzt gehen.
------------------------------------------------
Jan212
Posts: 859
Joined: Wed 28. Jan 2004, 21:38
Location: Solingen
Contact:

Post by Jan212 »

:arrow: ATTENTION
--------------------------------------------------------------
THERE IS A BETTER SOLUTION BY PIXELPETER
HERE
--------------------------------------------------------------
THANKS TO HIM, AWESOME

BEST REGARDS
Regards/ Grüsse/ Groetjes - JAN212
------------------------------------------------
null212 - Büro für Kommunikation und Design
------------------------------------------------
Lyrikfetzen des Tages
1. Ist der Quelltext auch valide fragt Herr Müller ganz perfide.
2. Wat is dat een lekker ding.
3. Wer Vision hat soll zum Arzt gehen.
------------------------------------------------
Post Reply