Page 1 of 1

mod_rewrite request

Posted: Fri 7. Nov 2003, 16:25
by Rylas
Hi how is it going guys?

I am sorry, im English, so if there has been another topic with this discussion in it, I apologize, I wouldn't have known.

Anyways, I thought it would be a really cool idea to incorperate a mod_rewrite hack into the portal, where as links that look like http://www.blah.com/index.php?id=52,34,1,0,0,0 would turn out to be http://www.blah.com/52,34,1,0,0,0.html

I would do it myself on my own website but I dont know how you have the hardlinks/softlinks set up and where I would have to modify it.

But anyways, there is my request.

And good job on the completed documentation Oliver :D

Posted: Fri 7. Nov 2003, 18:58
by Oliver Georgi
Thanks, but not completed at the moment - the documentation.

I have thought about mod_rewrite too. What do you need to know for realize this?

I have no experiences with that.


Oliver

Posted: Sun 9. Nov 2003, 12:48
by sheline
If you want links like "52,34,1,0,0,0.html" just create an .htaccess with following options:

RewriteEngine on
RewriteRule ^(.*)\.html$ index.php?id=$1
RewriteRule ^index.html$ index.php

Copy this .htaccess into the root directory (where phpwcms is installed).

Now you can access your page with:

your-domain.tld/index.html
your-domain.tld/52,34,1,0,0,0.html


I will look in the next days for a better soloution like

your-domain.tld/52/34/1/0/0/0.html
or
your-domain.tld/52-34-1-0-0-0.html


Cheers

Torsten Wenzel

Posted: Mon 10. Nov 2003, 22:45
by sporto
That's a good solution, but you'd still want the links generated by WCMS to use the MODRewrite so there would be some coding that had to happen. Of course, this is beyond my skills. :(

And for thoes who don't know why people want this... Many search engines don't like to index URLs with questionmarks in them. Using ModRewrite is a way around this.

found a solution

Posted: Mon 17. Nov 2003, 18:13
by Rylas
Hi guys, just wanted to let you know that I have found a solution, but have only tested it on the downloads part of phpwcms.

Code: Select all

RewriteEngine On

RewriteRule ^/download.php?id=([0-9]*),([0-9]*),([0-9]*$) /download/$1/$2/$3.html
Would let you use:

http://www.blah.com/download/32/42/48.html

Instead of:

http://www.blah.com/download.php?id=32,42,48

--

I am currently working on altering the phpwcms code to output of these kind of links, but it will take a while since there are thousands of lines of code to overview so I dont disturb the output of the hard links.

Posted: Mon 17. Nov 2003, 18:24
by Oliver Georgi
Hi Rylas,

I think - do not check the code. It is simpler to write a preg_replace routine that checks the whole rendered content and replaces "old-style" links to rewritten format. This is much easier.

Oliver

Posted: Mon 17. Nov 2003, 18:31
by marco
What kind of performance impact are you noticing with mod_rewrite?

Posted: Mon 17. Nov 2003, 20:53
by Rylas
performance is minimal, mod_rewrite is a stable module written for apache. It takes about the same time to process a rewrite request then it does to process an HTACCESS file without the rewrite engine enabled.

howto

Posted: Wed 19. Nov 2003, 23:23
by rudeboy
hi all

i opened a new howto implement search enginge compatibility thread: click here to read more :D