Unstoppable Domains

Mod Rewrite help

Spaceship Spaceship
Watch

firestorm

Established Member
Impact
6
Hey all,

I'm trying to wrap my head around a site I am working on. All of the content is in a mysql database set up (mini-sites ->pages in site -> content blocks)

I'm stuck over how to get each page to appear in the url. If I had 3 pages, say home about and contact i would want them to be:
url.com/
url.com/about/
url.com/contact/

I have 1 index page (template) so far, and I would like the url to go to that page and affect which page table i get in the query. Would this be done with mod-rewrite?

Any pointers would be great!
Thanks.
-fire
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
A mixture of mod_rewrite and php. Your .htaccess could read something like:
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [L]

Then url.com/about is the same as url.com/index.php?page=about.

You can then set up your queries using $_GET.
PHP:
Code:
if ($_GET['page']) {
   mysql_query("SELECT content, headings, etc FROM minisites WHERE name='" . $_GET['page'] . "'");
   mysql_fetch_array...
}

Does that answer your question?
 
0
•••
Yes it does! Thanks, I just couldn't grasp it earlier for some reason. Will work on that this today then.
Thanks again.
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back