Page 1 of 2

Rewrite is driving me nuts

Posted: Fri 30. Jul 2004, 23:18
by stevenlyons
I have read all the posts on this and still can't get it to work.

Can somebody please explain, one step at a time, everything that needs to be done to activate the URL rewrite function. Please?

Thanks.

Posted: Fri 30. Jul 2004, 23:23
by Pappnase
hello

it's quite simple

rename the _.htaccess to .htaccess

and goto the conf.inc.php and change line 63

from

Code: Select all

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

Code: Select all

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

Posted: Fri 30. Jul 2004, 23:35
by stevenlyons
Thanks for the quick reply!

My htaccess file was already named .htaccess by the host and I have changed the conf.inc.php file as indicated. It does not work.

I have phpWCMS located in a directory called /cms...will this affect things?

Posted: Fri 30. Jul 2004, 23:36
by pSouper
BACKUP YOUR .HTACCESS fiel first then try this...
(The following code should be the ONLY code in your .htaccess)

Code: Select all

php_flag magic_quotes_gpc Off
php_flag register_globals Off

RewriteEngine On

^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.shtml$ index.php?id=$1.$2.$3.$4.$5.$6

RewriteRule ^(.+)\.shtml$ index.php?$1
if this doesn't work then post back for another way.

Posted: Fri 30. Jul 2004, 23:39
by DeXXus
stevenlyons wrote:Thanks for the quick reply!

My htaccess file was already named .htaccess by the host and I have changed the conf.inc.php file as indicated. It does not work.

I have phpWCMS located in a directory called /cms...will this affect things?
~THAT~ .htaccess file is the one your system is using and NOT the one that comes with phpWCMS. You will need to ADD the contents of "_.htaccess" to your provider's file and read the part about "if phpWCMS is in a subdirectory"
# If phpwcms is installed in a subdirectory,
# sample: "mysubdir" then use this (remove #)
# if above lines doesn't work for you
# ===============================================
#RewriteBase /mysubdir
#RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.shtml$ /mysubdir/index.php?id=$1.$2.$3.$4.$5.$6
#RewriteRule ^(.+)\.shtml$ /mysubdir/index.php?$1

Posted: Fri 30. Jul 2004, 23:42
by stevenlyons
Thanks. It works now.

lost with the rewrite stuff... (1&1 root server)

Posted: Sat 11. Sep 2004, 02:47
by RonDog
Hi folks,

I have the same trouble with the rewrite issue, and I think (as everyone I guess) I tried everything for the last two days, but I can’t get the bloody thing working.
  • OK, here are my tech data’s:

Code: Select all

1&1 root server
system:  Linux pXXXXXXXX 2.6.7-040722 #1 SMP Thu Jul 22 21:41:08 CEST 2004 i686  
server:  Apache/2.0.49 (Linux/SuSE) 
php:     v4.3.4 
path:    /home/htdocs/web0/html
When I use the (unchanged ! & renamed) _.htaccess as recommended, I get a server script error (guess #500), so I used CONFIXX and the “httpd special” feature and put this code there for my account:

Code: Select all

DocumentRoot /home/htdocs/##user##/html

php_admin_flag safe_mode off
php_admin_value post_max_size 10M
php_admin_value memory_limit 32M
php_flag magic_quotes_gpc Off
php_flag register_globals Off

Options FollowSymLinks
RewriteEngine On

DirectoryIndex index.html index.php 

RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.phtml$ index.php?id=$1.$2.$3.$4.$5.$6

RewriteRule ^(.+)\.phtml$ index.php?$1
Just stripped comments out to save space :lol:

With these settings without rewrite_url ON, I do not get any errors. Btw. I used any combination possible step by step, while switching “$phpwcms["rewrite_url"]” ON and OFF, but in ON mode I get this message

Code: Select all

Bad request!
Your browser (or proxy) sent a request that this server could not understand. 
(ehem… me too :oops: )

as soon as I try to switch to any of the pages of my test app.


This is the part of my conf.inc.php concerned:

Code: Select all

// site values
$phpwcms["site"]              = "http://www.xxxxxxx.de/";
$phpwcms["admin_email"]       = "xxxxxx@web.de";

// paths
$phpwcms["root"]                = "";         //default: ""
$phpwcms["file_path"]         = "phpwcms_filestorage";    //default: "phpwcms_filestorage"
$phpwcms["file_tmp"]          = "phpwcms_tmp";     //default: "phpwcms_tmp"
$phpwcms["templates"]         = "phpwcms_template";    //default: "phpwcms_template"
$phpwcms["dir_thlist"]        = "thumb_list";   //default: "thumb_list"
$phpwcms["dir_preview"]       = "thumb_preview";  //default: "thumb_preview"
$phpwcms["content_path"]      = "content"; //default: "content"
$phpwcms["cimage_path"]       = "images";  //default: "images"
$phpwcms["ftp_path"]          = "phpwcms_ftp";     //default: "phpwcms_ftp"

.
.
.

// other stuff
$phpwcms["compress_page"]     = 0; //0 = OFF, 1-9: page compression ON (1 = low level, 9 = highest level)
$phpwcms["imagick"]           = 1; //0 = GD,  1 = ImageMagick, 2 = ImageMagick 4.2.9
$phpwcms["imagick_path"]      = "/usr/bin"; //Path to ImageMagick (default="" - none)
$phpwcms["use_gd2"]           = 1; //0 = GD1, 1 = GD2
$phpwcms["rewrite_url"]       = 0;  //whether URL should be rewritable
$phpwcms["wysiwyg_editor"]    = 4;  //0 = no wysiwyg editor, 1 = HTMLarea, 2 = FCKeditor, 3 = browser based
$phpwcms["phpmyadmin"]        = 1;  //enable/disable phpMyAdmin in Backend
$phpwcms["default_lang"]      = "en";  //default language
$phpwcms["charset"]           = "iso-8859-1";  //default charset 'iso-8859-1'
$phpwcms["allow_remote_URL"]  = 0;  //0 = no remote URL in {PHP:...} replacement tag allowed, 1 = allowed
$phpwcms["gt_mod"]            = 0;  //0 = Graphical Text MOD disabled, 1 = enabled
$phpwcms["jpg_quality"]       = 75; //JPG Quality Range 25-100
$phpwcms["sharpen_level"]     = 1;  //Sharpen Level - only ImageMagick: 0, 1, 2, 3, 4, 5 -- 0 = no, 5 = extra sharp
$phpwcms["allow_ext_init"]    = 1;  //allow including of custom external scripts at frontend initialization
$phpwcms["allow_ext_render"]  = 1;  //allow including of custom external scripts at frontend rendering
I am at a loss as to what to do next…

I killed the .htaccess now, but someday, this century, I’d like to run search engine friendly URL’s….

Anyone got a clue about this issue?
Help desperately needed and appreciated!

(helpless) Ron

Posted: Sat 11. Sep 2004, 03:21
by Pappnase
hello

you have a searchengine friendly cms! cos maybe google will scan the whole page! also as php pages.!*smile*

look at this!

http://www.google.de/search?hl=de&ie=UT ... tion&meta=

Posted: Sat 11. Sep 2004, 03:44
by RonDog
nice try "paper nose" :mrgreen:

but that does not solve the problem!

even if mr. google does his job...

it's like a book keeping problem. one cent difference may be the result of a huge mismatch in the whole account, and so I think about this subject too...

Ron

Posted: Sat 11. Sep 2004, 04:05
by DeXXus
I use one of their free three-year "promotional" accounts and the ".htaccess" cannot contain these types of commands in my particular setup:

Code: Select all

php_admin_flag safe_mode off 
php_admin_value post_max_size 10M 
php_admin_value memory_limit 32M 
php_flag magic_quotes_gpc Off 
php_flag register_globals Off 
You can comment them out -or- the way they are used on my account... is to create a "php.ini" file in each directory that you would like to waver from the master "php.ini" file. That is in a "hosted" situation though.

Posted: Sat 11. Sep 2004, 05:00
by RonDog
well.

I could (btw. I already did it 2 days ago) change those parameters in the server core, because I have full access (lucky me), but WCMS was still arguing about this and pretended not to know anything about, even after a reboot of the server.

so I decided to put this lines into the .htaccess and (as far as I remember - after so much puzzling around) this lines alone have been accepted, but I try without those lines tomorrow... about noon today. it was another 20 hours workin day and I'm fed up for now... :roll:

C U & I let Ya know...
Ron

Re: Rewrite is driving me nuts

Posted: Thu 7. Oct 2004, 12:07
by Peekay
stevenlyons wrote:I have read all the posts on this and still can't get it to work.

Can somebody please explain, one step at a time, everything that needs to be done to activate the URL rewrite function. Please?

Thanks.
I strongly second this request. This is the only thing about PHPWCMS that I simply cannot figure. IMHO needs an official developer's tutorial covering the following:

1) What the heck does URL-rewrite actually do?

2) As it is an option, do we even need to use it?

3) If everyone can utilise this feature, can we have a step by step guide to setting it up on a commercial webhost - which normally means safe-mode on, register_globals on and no direct access to the server configuration.

Plus any optional settings to help get it working for everbody. 8)

Posted: Tue 10. May 2005, 03:52
by ndtoan13
DeXXus wrote:
stevenlyons wrote:Thanks for the quick reply!

My htaccess file was already named .htaccess by the host and I have changed the conf.inc.php file as indicated. It does not work.

I have phpWCMS located in a directory called /cms...will this affect things?
~THAT~ .htaccess file is the one your system is using and NOT the one that comes with phpWCMS. You will need to ADD the contents of "_.htaccess" to your provider's file and read the part about "if phpWCMS is in a subdirectory"
# If phpwcms is installed in a subdirectory,
# sample: "mysubdir" then use this (remove #)
# if above lines doesn't work for you
# ===============================================
#RewriteBase /mysubdir
#RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.shtml$ /mysubdir/index.php?id=$1.$2.$3.$4.$5.$6
#RewriteRule ^(.+)\.shtml$ /mysubdir/index.php?$1
I do everything above (rename _.htaccess, remove '#' for subderectory, ) but it just change the url, and I get 404 error?? I saw some post say about changing the httpd.conf of apache : AllowOverride All but I dont know where to change, I change something and get Internal Server Error?

Any idea?

Posted: Tue 10. May 2005, 04:05
by Pappnase
hello

test i first withou removeing of # for sub dirs!
cos sometime it works!
also refer you php.info to look if the mod_rewrite module is also loaded!

Posted: Tue 10. May 2005, 04:23
by ndtoan13
Pappnase wrote:hello

test i first withou removeing of # for sub dirs!
cos sometime it works!
also refer you php.info to look if the mod_rewrite module is also loaded!
Thank you for quick reply.
I have done both: if I leave .htaccess file as default (not subdir) It cause the same error :

Code: Select all

http://localhost/mydir/index.php?c15 => http://localhost/mydir/_c15.shtml
as I did when I remove # for subdir

About php_info, I get

Code: Select all

url_rewriter.tags a=href,area=href,frame=src,input=src,form=,fieldset= a=href,area=href,frame=src,input=src,form=,fieldset=