Reply to Re: can you redirect every existing html page through a php function?

Your name:

Reply:


Posted by Stephen Kay on 03/31/06 07:33

in article C04E2935.5AC82%sk@karma-lab.nospam.com, Stephen Kay at
sk@karma-lab.nospam.com wrote on 3/27/06 11:46 PM:

>> What server are you using?
>> If you are using apache then you can use RewriteRule ... It will do exactly
>> what you are after.
>>
>> RewriteRule ^([^/]+)/([^/]+).html$ /dopage.php?p=$1 [L]
>>
>> Then you can worry about what dopage.php actually does.

Hi, I've been working on this, and it's working.

But presently, I'm doing this:

RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+).html$
/dopage3.php?p=$1/$2/$3/$4.html
RewriteRule ^([^/]+)/([^/]+)/([^/]+).html$ /dopage3.php?p=$1/$2/$3.html
RewriteRule ^([^/]+)/([^/]+).html$ /dopage3.php?p=$1/$2.html
RewriteRule ^([^/]+).html$ /dopage3.php?p=$1.html [L]


This looks really stupid to me, but I haven't come on a better syntax.

In other words, it needs the first line to redirect something like:

folder1/folder2/folder3/file.html to
/dopage.php?p= folder1/folder2/folder3/file.html

and then the next line to do

folder1/folder2/file.html to
/dopage.php?p= folder1/folder2/file.html

...etc., depending on how many layers down the html is nested.

Is there a simpler way to write this that only takes one line? I would have
thought something like this (based on my limited understanding), but it
doesn't seem to work exactly the same:

RewriteRule ^([*]).html$ /dopage3.php?p=$1.html [L]



--
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM.com
^^^^^^^

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация