Results 1 to 1 of 1

Thread: Php + rewrite rules - help required!

  1. #1
    Join Date
    Apr 2012

    Php + rewrite rules - help required!

    I was trying to rewrite some urls witht he following rule:
    RewriteRule ^([a-z0-9-]*)$ news.php?slug=$1
    it works as long as i try site.com/title-goes-here

    but it also means that any word a-z char and 0-9 typed after site.com will be taken as slug
    so when i try to use this rule (also working before apply the ^ upper one)

    RewriteRule ^page$-([0-9]+)$ index.php?page=$1
    which would output the site.com/page-3(or 4 or whatever)

    i found a temporarely solution which helps the rule to "indicate" that only this type of urls should be received and "read" as slug
    RewriteRule ^test-([a-z0-9-]*)$ news.php?slug=$1
    seems that the word test- helps to be read correctly so , when i try site.com/test-something-here
    something-here is "read" as slug,which is perfectly well,but i hate to add any extra words on my urls,so i was hopeing that you can help me solve this.

    The result i am looking for is this:
    rewrited url --------------------------- original url
    site.com/some-title-of-the-news - site.com/news.php?slug=title-of-the-news (i don't want to add any / chars e.g. sitem.com/news/tite-of-the-news if this is possible!)
    site.com/page-1 - site.com/index.php?page=1
    site.com/contactme - site.com/contactform.php

    Thanks in advance!
    Last edited by wdas; 09-29-2012 at 09:32 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles