b.com/sect/ent/something.php to b.com/index.php/sect/ent

Discuss practical ways rearrange URLs using mod_rewrite.

b.com/sect/ent/something.php to b.com/index.php/sect/ent

Postby Indijanac » Thu Feb 17, 2005 10:15 am

Hi everyone,

I what to be able to have file name in my URL that would be ignored. I have a central switch, so for example:

http://www.blah.com/section/entity/index.php

would map to:

http://www.blah.com/index.php/section/entity

Thanks for help!
Indijanac
 

Re: b.com/sect/ent/something.php to b.com/index.php/sect/ent

Postby Indijanac » Thu Feb 17, 2005 11:41 am

Indijanac wrote:Hi everyone,

I what to be able to have file name in my URL that would be ignored. I have a central switch, so for example:

http://www.blah.com/section/entity/index.php

would map to:

http://www.blah.com/index.php/section/entity

Thanks for help!


To clarify myself.. I now use

Code: Select all
DirectoryIndex index.php

RewriteEngine On
RewriteRule ^([^.]+)?$ /index.php/$1


And that works nice, i have URLs like:

www.com/lang/section/sectionentity/subs ... tionentity

Everything is ok. Now I need pagination, and with above this works:

www.com/lang/section/sectionentity/subs ... =3&show=10

But if I insert index.php, Apache tries to find it and that does not work:

www.com/lang/section/sectionentity/subs ... =3&show=10
Indijanac
 

rewrite to PathInfo

Postby Caterham » Thu Feb 17, 2005 3:35 pm

Code: Select all
RewriteEngine On
RewriteRule ^index.php - [L]
RewriteRule ^(.+)/([^/]+)$ /index.php/$1 [L]


note that this will not match www.example.com/index.php
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm

Re: rewrite to PathInfo

Postby Indijanac » Fri Feb 18, 2005 11:47 pm

Caterham wrote:
Code: Select all
RewriteEngine On
RewriteRule ^index.php - [L]
RewriteRule ^(.+)/([^/]+)$ /index.php/$1 [L]


note that this will not match www.example.com/index.php


Thanks. That is acceptable.
But as this does work, it is extremly slow. It takes 10-15 seconds before page loads.
Indijanac
 

Postby Caterham » Sat Feb 19, 2005 6:40 am

It takes 10-15 seconds before page loads
usualy not... the rules should be processed within half a second.

may be PHP slows down with PathInfo? Why don't you use a QueryString?
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: Google [Bot] and 18 guests

cron