mod rewrite - mod_rewrite style URL replacement in PHP -
i'm looking simple solution rewrite url in php. customer wants store them in database can't use mod_rewrite.
basically looking php solution make happen:
^/(.*).html ==> /page.$1.html
such php code exists? thank in advance.
i'm not entirely sure mean example since create never-ending redirection loop.
^/(.*).html ==> /page.$1.html ==> /page.page.$1.html ==> /page.page.page.$1.html ==> etc.
i'm assuming since said you're getting these rules database want take specific strings instead of (.*)
what want match whatever you're trying search $_server['request_uri']
variable , redirect using php. this:
foreach ($searches $string) { if (preg_match("@^/$string\.html$@", $_server['request_uri'])) { header("http/1.1 301 moved permanently"); header("location: http://www.yoursite.com/page.$string.html"); } }
Comments
Post a Comment