mod_rewrite request

Use GitHub to post feature requests for phpwcms.
Locked
Rylas
Posts: 9
Joined: Fri 7. Nov 2003, 16:17

mod_rewrite request

Post 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
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post 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
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
sheline
Posts: 1
Joined: Sun 9. Nov 2003, 12:43
Location: Köln
Contact:

Post 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
sporto
Posts: 160
Joined: Mon 10. Nov 2003, 18:01
Location: USA, Chicago

Post 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.
Rylas
Posts: 9
Joined: Fri 7. Nov 2003, 16:17

found a solution

Post 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.
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post 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
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
marco

Post by marco »

What kind of performance impact are you noticing with mod_rewrite?
Rylas
Posts: 9
Joined: Fri 7. Nov 2003, 16:17

Post 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.
rudeboy
Posts: 16
Joined: Wed 19. Nov 2003, 21:19

howto

Post by rudeboy »

hi all

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