HOW2 - create bot-friendly URL
Posted: Tue 2. Mar 2004, 20:43
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 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...
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
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
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);
}
That's all - best regards
A yockl from the deepest backwood of germany