View Full Version : rewrite func

07-16-2012, 04:36 PM
Hi, I want to rewrite some url's from a dir/folder/folder2 to mysite.com/contact.html via php, i dont know how, i've made come up with this func:

* NOTES >>
* - The array order is also the default sort order.
* - 'live' values can be true/false
* - 'title' values can use $lang[] values or any value.

$pages_config = array (
'about' => array('live' => true, 'title' => 'About Us'),
'tos' => array('live' => true, 'title' => 'Terms of Service'),
'contact' => array('live' => true, 'title' => 'Contact'),

now does any1 know hhow to go about this?

07-16-2012, 05:09 PM
Well, htaccess is the usual way to do this, or combining htaccess with a controller (it seems you wanna do the latter here. Unfortunately, I'm not a pro with htaccess, so hopefully someone else can help you figure out how to redirect individual pages to a controller rather then everything.

Getting everything to forward to a page and then having that page pull pages is easy enough to do if you wanna go that route.

07-16-2012, 05:34 PM
Yea, Keleth.

That sounds spot on what I want to do, I really dont wanna mess with htaccess, atleast for these theme dir.

07-16-2012, 05:36 PM
If you don't wanna mess with htaccess, then just use a PHP redirect?

header('Location: newPage.ext');

07-16-2012, 05:56 PM
See, all my theme pages are in:

content/themes/ [THEME NAME] / pages/file.php

Ideally somehow I want, mysite.com/file.html

So would header(); work?

07-16-2012, 06:00 PM
Wait, so is it you don't want anyone to be able to access those folders? htaccess is ideal for that...

But if you wanna throw a redirect, its exactly as I put above, just change newPage.ext for wherever you want it to point. And since it is a header, it has to be before anything is echoed to the page.

07-16-2012, 06:16 PM
I'm not bothered about them accessing, although a 301 would be great.

hmm i'm reading htaccess redirect match...

Can you help??????