Page 1 of 2

REWRITE UPDATED

Posted: Thu 15. Apr 2004, 21:13
by Jan212
////////////////////////////////////////////////////////////////////////////
//
// OPEN INCLUDE/INC_CONF/CONF.INC
// LINE: 62
//
///////////////////////////////////////////////////////////////////////////


// SEARCH FOR ///////////////////////////////////////

Code: Select all

$phpwcms["rewrite_url"]       = 0;        //whether URL should be rewritable

// REPLACE WITH ///////////////////////////////////////

Code: Select all

$phpwcms["rewrite_url"]       = 1;        //whether URL should be rewritable
////////////////////////////////////////////////////////////////////////////
// CLOSE
///////////////////////////////////////////////////////////////////////////




////////////////////////////////////////////////////////////////////////////
//
// OPEN INCLUDE/INC_FRONT/FRONT.FUNC.INC
// LINE: 1185
//
///////////////////////////////////////////////////////////////////////////


// SEARCH FOR ///////////////////////////////////////

Code: Select all

function url_search($query)    
{ 
   if ( subStr($query,0,4) == "?id=") 
   { 
      // this is for id=0,0,0,0,0 
      $noid = substr($query, 4); 
      $file = str_replace(",", ".", $noid).".htm"; //further use 
   } 
   else 
   { 
      // this is for mypage.html 
      $noid = substr($query,1); 
      $file = str_replace(",", ".", $noid).".html"; //further use 
   } 
   $link = "<a href="".$file."""; 
   return($link); 
} 


// REPLACE WITH ///////////////////////////////////////

Code: Select all

//REWRITE - PATCHED FOR 04/04 // jan212
function url_search($query) { 
   if ( subStr($query,0,4) == "?id=") { 
      $noid = substr($query, 4); 
      $file = str_replace(",", ".", $noid).".html"; 
      } 
   else { 
      $noid = substr($query,1); 
      $file = str_replace(",", ".", $noid).".html"; 
   } 
   $link = "<a href=\"".$file."\""; 
   return($link); 
} 

function js_url_search($query) { 
   if ( subStr($query,0,4) == "?id=") { 
      $noid = substr($query, 4); 
      $file = str_replace(",", ".", $noid).".html"; 
   } else { 
      $noid = substr($query,1); 
      $file = str_replace(",", ".", $noid).".html"; 
   } 
   $link = "onClick=\"location.href='".$file."'"; 
   return($link); 
} 
// -------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
// CLOSE
///////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////
//
// SAVE THIS AS .HTACCESS IN THE PHPWCMS ROOT FOLDER
//
///////////////////////////////////////////////////////////////////////////

Code: Select all

php_flag magic_quotes_gpc Off
php_flag register_globals Off

DirectoryIndex index.php 
RewriteEngine on 

# if your in an subdirectory called "phpwcms" define the rewrite-base 
# RewriteBase /phpwcms  
# Otherwise remove the /phpwcms/ from the rewrite rules (should be 
# index.php?id=$1.$2.$3.$4.$5.$6, index.php?$1 then)

# This will rewrite 0.0.0.0.0.html => index.php?id=0.0.0.0.0
RewriteRule
^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]html$
/phpwcms/index.php?id=$1.$2.$3.$4.$5.$6
# This will rewrite mypage.html => index.php?mypage
RewriteRule (.+)[.]html /phpwcms/index.php?$1
#THIS FOR LOGGING
#RewriteLog "/absolute/path/to/the/rewrite.log" 
# 0 = Logging disabled, 9 = highest level of logging, only for debugging 
#RewriteLogLevel 3

////////////////////////////////////////////////////////////////////////////
// IMPORTANTLY
// # if your in an subdirectory called "phpwcms" define the rewrite-base
// # RewriteBase /phpwcms
// # Otherwise remove the /phpwcms/ from the rewrite rules (should be
// # index.php?id=$1.$2.$3.$4.$5.$6, index.php?$1 then)
/////////////////////////////////////////////////////////////////////////



////////////////////////////////////////////////////////////////////////////
// THAT'S IT
/////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////
// DEBUGGING
/////////////////////////////////////////////////////////////////////////

Error 404 - check your .htaccess again, the subdir, slashes and so on, normally the bug should be there if this type of error is displayed

Error 403, 500 - Apache misconfiguration - set up AllowOverride All and Options +FollowSymLinks in httpd.conf

Re: REWRITE UPDATED

Posted: Thu 15. Apr 2004, 21:18
by frold
Jan212 wrote:
php_flag magic_quotes_gpc Off
php_flag register_globals Off

DirectoryIndex index.php
RewriteEngine on

# if your in an subdirectory called "phpwcms" define the rewrite-base
# RewriteBase /phpwcms

# This will rewrite 0.0.0.0.0.html => index.php?id=0.0.0.0.0
RewriteRule
^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]html$
/phpwcms/index.php?id=$1.$2.$3.$4.$5.$6
# This will rewrite mypage.html => index.php?mypage
RewriteRule (.+)[.]html /phpwcms/index.php?$1
#THIS FOR LOGGING
#RewriteLog "/absolute/path/to/the/rewrite.log"
# 0 = Logging disabled, 9 = highest level of logging, only for debugging
#RewriteLogLevel 3
The things in bold needed to changed to your folder where phpwcms is located if it's not stored in a folder it need to be deleted.... Do I understand it right?

Posted: Thu 15. Apr 2004, 21:22
by pSouper
thanks for this jan, i've not tested it but notice that there are no IIS specific instructions. Am I to assume that if you use IIS you just ingnor the .htaccess stuff all together?

Posted: Thu 15. Apr 2004, 21:28
by Jan212
@ frold - take a look, i've declared it specially so everybody should get it...

@ pSouper - sorry, don't know anything about IIS - that's not my area...

Posted: Thu 15. Apr 2004, 21:32
by frold
Jan212 wrote:@ frold - take a look, i've declared it specially so everybody should get it...
Once again im to slow

Posted: Thu 15. Apr 2004, 23:20
by Jan212
or once again you was to fast... :wink: good night

Posted: Sat 17. Apr 2004, 01:42
by Stephan
First Time post.... I have 2 install underway and I must say that I am very impressed both with the original code and the community.

I have installed the rewite for menu and breadcrumbs, and I am wondering how do you guys get around the problems it causes with the HTML editor ?

Can the rewrite rule be written in such a way to ignore the files the editor wants to load ? or can the editor itself to configured to a different extension on the popups so that it doesn't conflict ?

If anyone has a hack or workaround please let me know.

Posted: Sat 17. Apr 2004, 02:58
by Stephan
I have my install in a folder called cms for now, and I was able to fix the editor problem by restricting the rewrite rule to the folder cms

RewriteCond %{REQUEST_URI} ^/(cms)/?.*$
RewriteRule ^([a-zA-Z0-9_]+)\.html$ /cms/index\.php?$1 [L]

another way would be to set a rewrite condition to ignore files starting with fsk_

If someone is good with regex and mod rewrite please post a Condition that works

Posted: Tue 20. Apr 2004, 19:33
by trip
Apache misconfiguration - set up AllowOverride All and Options +FollowSymLinks in httpd.conf
What happens if you dont have access to the httpd.conf file
can you set this up using another method??

regards
TriP

Posted: Tue 20. Apr 2004, 20:58
by Jan212
only if you could define a httpd entry or have access to modify the virtual host entry

Posted: Tue 20. Apr 2004, 23:43
by DeXXus
trip wrote:
Apache misconfiguration - set up AllowOverride All and Options +FollowSymLinks in httpd.conf
What happens if you dont have access to the httpd.conf file
can you set this up using another method??

regards
TriP
If you can create a ".htaccess" file, you can try inserting those two lines into the beginning of it:
////////////////////////////////////////////////////////////////////////////
//
// SAVE THIS AS .HTACCESS IN THE PHPWCMS ROOT FOLDER
//
///////////////////////////////////////////////////////////////////////////


Code:

AllowOverride All
Options +FollowSymLinks

php_flag magic_quotes_gpc Off
php_flag register_globals Off

DirectoryIndex index.php
RewriteEngine on

# if your in an subdirectory called "phpwcms" define the rewrite-base
# RewriteBase /phpwcms
# Otherwise remove the /phpwcms/ from the rewrite rules (should be
# index.php?id=$1.$2.$3.$4.$5.$6, index.php?$1 then)

# This will rewrite 0.0.0.0.0.html => index.php?id=0.0.0.0.0
RewriteRule
^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]html$
/phpwcms/index.php?id=$1.$2.$3.$4.$5.$6
# This will rewrite mypage.html => index.php?mypage
RewriteRule (.+)[.]html /phpwcms/index.php?$1
#THIS FOR LOGGING
#RewriteLog "/absolute/path/to/the/rewrite.log"
# 0 = Logging disabled, 9 = highest level of logging, only for debugging
#RewriteLogLevel 3

Posted: Wed 21. Apr 2004, 01:29
by Mario670
it seems there is an error in the .htaccess by using the FCKeditor, when you click on a button at fckeditor (for example "insert picture") I will see in the pop up my homepage (my index.php, the startpage) and not the right pop up to insert a picture by URL.

has anybody else this problem, or could anybody check it?

When i turn off my htaccess, all functions in fckeditor will works fine. :?:

mario

sorry for my bad english, i hope you can understand my problem?

Posted: Wed 21. Apr 2004, 01:38
by Stephan
Stephan wrote:I have my install in a folder called cms for now, and I was able to fix the editor problem by restricting the rewrite rule to the folder cms

RewriteCond %{REQUEST_URI} ^/(cms)/?.*$
RewriteRule ^([a-zA-Z0-9_]+)\.html$ /cms/index\.php?$1 [L]

another way would be to set a rewrite condition to ignore files starting with fsk_

If someone is good with regex and mod rewrite please post a Condition that works
The answer to the problem is here....

Posted: Wed 21. Apr 2004, 08:25
by trip
Thank you Dexus
I will give this a go and let you know if this works..

TriP.

Posted: Fri 23. Apr 2004, 09:03
by trip
Well Dexus
I have tried adding the
AllowOverride All and Options +FollowSymLinks

to the .htaccess, but I get an error 500

I assume this is to do with the httpd.conf, which I dont have access to??

let me know
TriP