Jump to content

jamieburchell

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jamieburchell's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi How about something like this: RewriteRule ^news/([0-9]+)-([a-zA-Z0-9-]+)/?$ ?k=news&id=$1&title=$2 Your url would need to look like news/1-my-news-item/ In your code you would then use $_GET[‘id’] and $_GET[‘title’] Jamie.
  2. I doubt they will know. What version of Apache is running on your server vs the version that you have managed to get working. I am running Apache 2.2.6 on Windows and basically all the problems are resolved by adding an end dollar for the string terminator. I get: RewriteRule ^register /register.php -- 500 server error RewriteRule ^register /xregister.php -- rule works (sort of see below) RewriteRule ^register$ /register.php -- rule works You'll find without the end of string terminator all sorts of unexpected stuff happens like the url /registerxyz will still resolve to /xregister.php.
  3. Hi I notice on your examples you are missing the end dollar. I am pretty sure this is your issue. RewriteRule ^phones /phones.php I would make: RewriteRule ^phones$ /phones.php or better: RewriteRule ^phones/?$ /phones.php I've not managed to get: RewriteRule ^(.*)$ /write.php?$1 [L] to work either. I have no idea why this is. I ended up having to use: ([a-zA-Z0-9-/]+) which did what I needed.
  4. Hi there In your first example, if you access "/matches/" the second rule is redirecting you to your about page. This is because ^([a-zA-Z0-9]+)/$ is trying to find any combination of letters and numbers and a slash, which includes the string "/matches/". If you want something else to happen when you access "/matches/", create rules like this: RewriteRule ^matches/?$ ?k=matches RewriteRule ^about/?$ ?k=about The question mark is useful before the slash as it means with or without the preceding character. Hope this helps. Jamie
  5. Hi all Could someone please help me understand what's going on here. I would like the last rules of my config to pass the full url to a script that looks it up in a database to find the page that should be displayed. So I have the following rules: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([a-z0-9-/]+)/$ /index.php?c=page&url=/$1 [L] RewriteRule ^([a-z0-9-/]+)$ /index.php?c=page&url=/$1 [L] I put two lines here because I couldn't work out how to make /test/test and /test/test/ (with trailing slash) result in $1 being /test/test (no trailing slash) so that the database lookup works consistently. Anyway, if I create a directory called "example" with a default "index.html" file there and access it by going to /example, Apache tries processes the bottom two RewriteRules rather than getting the default index file. Very annoying and can't seem to find a way around this. I tried looking this up but haven't had much luck. Tried using the NS switch too on those lines to no avail. I am using Apache version 2.2.6. Any help greatly appreciated. Thanks Jamie.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.