Page 1 of 1

Mod_rewrite question

Posted: Fri 11. Mar 2005, 16:06
by Jimmy_Jazz
Hi

I was wondering if the mod rewrite function for phpwcms could be made to include the pathway of where you are in the site - like a breadcrumb - for example at the moment however deep you are in the site the url is always written like this

http://www.mysite.com/photography.phtml

This is great but is it posible to include the hierarchy of the site in the url - ie if the section 'photography'' is a child of the section 'Portfolio' it would be written like this:

http://www.domain.com/portfolio/photography.phtml

I noticed that in previous versions of wcms you could use '/' in an alias and thus produce this effect (as long as you had a base href link in the template) . This is no longer possible in the current DEV release.

Some may say this is not really neccessary but I think it looks more professional.

Cheers

Posted: Fri 11. Mar 2005, 17:01
by Pappnase
hello

you're not the first who ask for that :wink:

and as far as i know this is not possible!

Posted: Fri 11. Mar 2005, 17:09
by pico
Hi

it's complicated because the real Address to the Content is not in a Path like Portfolio - wath Rewrite is doing is just a 'tranlation' of the Part

index?id=13,67,0,0,1,0 into a friendly Address like test.phtml

and there is no Path-Information in to 'translate'

Posted: Fri 11. Mar 2005, 17:29
by Jimmy_Jazz
Ok I think I understand. Thats a shame though. How do other cms do it?

You could work around it in the previous version of wcms by using a '/' in the alias and a base href in the template. This is not possible any more with 1.2 1 - it converts the '/' into a '_'

Posted: Fri 11. Mar 2005, 18:01
by Pappnase
hello

sorry i've never seen this!

Posted: Fri 11. Mar 2005, 18:14
by Jimmy_Jazz
Hi Pappnase

You would enter the alias as such:

Image

make sure the header of the template has this html code:

Code: Select all

<base href="http://www.wallcreative.com/">
the see here:

http://wallcreative.com/portfolio/thisi ... test.phtml


That was my work around the problem anyway.
But now in the DEV version it doesnt let you.

fixed yet?

Posted: Thu 14. Jul 2005, 00:27
by jonmayes
how about putting the following rule in your .htaccess file above your default page rewriting rules:

RewriteRule portfolio/(.*)$ $1 [PT]

This would rewrite portfolio/page.phtml to page.phtml and then to index.php?page, but to the user it'd appear as http://example.com/portfolio/page.phtml.

You'd need one such entry in htaccess for each directory you want to do this with though.

HTH