Page 1 of 1

help with mod_rewrite

Posted: Tue Aug 17, 2004 9:51 am
by vigge89
I've checked out mod_rewrite, and I thought that i'd give it a try and give my site user/search-engine -friendly URLs. The problem is that it does not matter what I do, while trying to access the pages i get 404 errors.

Here's my .htaccess which is lying in the root of the htdocs folder:

Code: Select all

ErrorDocument 404 /index.php?p=404

RewriteEngine On
RewriteRule ^/(їa-z0-9_-]+) /index.php?p=$1
(I would have changed the ErrorDocument 404 to /404/, if it would've work but it doesn't)

How I want the URLs to work (examples):
http://vigge.ath.cx/ (root) or /start/ - leads to index.php?p=start (or just index.php for root)
/files/ - leads to /index.php?p=files (ie, files section)
/econtent/?edit=somepage or /econtent/somepage/ - leads to /index.php?p=econtent&edit=somepage
As you can see, I want the query-string to be turned into a user-friendly url-part, but I would prefer it be possible to use the normal query-string way too (but it's not too important).

How it currently works:
http://vigge.ath.cx/ (root) or /?p=start - leads to index.php?p=start (or just index.php for root)
/?p=files - leads to /index.php?p=files (ie, files section)
/?p=econtent&edit=somepage
Any ideas?
Thanks in advance

Posted: Fri Aug 20, 2004 8:19 am
by vigge89
anyone? :(

Posted: Sat Aug 21, 2004 12:23 pm
by vigge89
also, im running Apache 2.0.50

Posted: Thu Aug 26, 2004 2:55 pm
by vigge89
My current .htaccess-file, which just leads me to the 404 page when trying to access /files/, /links/ or any other section...

Posted: Sat Aug 28, 2004 6:40 pm
by vigge89
i've got ithe page-part to work now, but i had to use /p/pagename/ to get it too work, here's the .htaccess:

Code: Select all

ErrorDocument 404 /index.php?p=404

RewriteEngine On
Options +FollowSymlinks

RewriteBase /
RewriteRule ^p/(їa-z0-9_-]*)/ /index.php?p=$1
RewriteRule ^/$ /index.php
However, when trying to access something like /p/files/?id=1 , it doesn't work, the get-request doesn't seem to be set, does anyone know how to fix this?


Edit: i finnaly got it too work, using this code:

Code: Select all

ErrorDocument 404 /index.php?p=404

RewriteEngine On
Options +FollowSymlinks

RewriteBase /

RewriteRule ^p/(їa-z0-9_-]*)$ /index.php?p=$1
RewriteRule ^p/(їa-z0-9_-]*)\/(.*) /index.php?p=$1&$2
RewriteRule ^p /index.php
this lets the visitor access a page with the following address:
/p/pagename/
and if more get-variables are used, add it to the end:
/p/pagename/variable=something

just a question, would this work for search-engines?