REWRITE UPDATED

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

REWRITE UPDATED

Post 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
Last edited by Jan212 on Thu 15. Apr 2004, 21:24, edited 3 times in total.
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.
------------------------------------------------
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Re: REWRITE UPDATED

Post 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?
http://www.studmed.dk Portal for doctors and medical students in Denmark
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post 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?
Jan212
Posts: 859
Joined: Wed 28. Jan 2004, 21:38
Location: Solingen
Contact:

Post 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...
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.
------------------------------------------------
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

Jan212 wrote:@ frold - take a look, i've declared it specially so everybody should get it...
Once again im to slow
http://www.studmed.dk Portal for doctors and medical students in Denmark
Jan212
Posts: 859
Joined: Wed 28. Jan 2004, 21:38
Location: Solingen
Contact:

Post by Jan212 »

or once again you was to fast... :wink: good night
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.
------------------------------------------------
Stephan
Posts: 17
Joined: Sat 17. Apr 2004, 01:38
Contact:

Post 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.
Stephan
Posts: 17
Joined: Sat 17. Apr 2004, 01:38
Contact:

Post 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
trip
Posts: 657
Joined: Tue 17. Feb 2004, 09:56
Location: Cape Town, South Africa
Contact:

Post 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
Jan212
Posts: 859
Joined: Wed 28. Jan 2004, 21:38
Location: Solingen
Contact:

Post by Jan212 »

only if you could define a httpd entry or have access to modify the virtual host entry
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.
------------------------------------------------
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post 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
Mario670
Posts: 59
Joined: Sun 18. Apr 2004, 23:52
Contact:

Post 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?
Stephan
Posts: 17
Joined: Sat 17. Apr 2004, 01:38
Contact:

Post 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....
trip
Posts: 657
Joined: Tue 17. Feb 2004, 09:56
Location: Cape Town, South Africa
Contact:

Post by trip »

Thank you Dexus
I will give this a go and let you know if this works..

TriP.
trip
Posts: 657
Joined: Tue 17. Feb 2004, 09:56
Location: Cape Town, South Africa
Contact:

Post 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
Post Reply