| |
| |
|
|
|
|
| |
|
| |
|
| :: |
| Author |
Message |
stevan
Joined: 10 Sep 2007 Posts: 3
|
Posted: Mon Sep 10, 2007 11:15 pm Post subject: mod_rewrite Help |
|
|
I have never done this before and I have a script I am trying to make works I fixed almost all the other errors BUT I wnat to make it so the pages are like my old script
Right now the main page web adress is
-http://www.webadress.net/links/-page-0.html I want to change it to
-http://www.webadress.net/links
and when on a Cat page it looks like this
-http://www.webadress.net/links/Education-page-0.html I want it to be
-http://www.webadress.net/links/Education
The second page would be
-http://www.webadress.net/links/Education/index2.html
Here is the file for it
| Code: |
RewriteEngine on
#categories
RewriteRule ^(.*)-page-(.*).html$ index.php?command=select&category=$1&pager_cmd=$2
#details page
RewriteRule ^details-(.*).html$ index.php?command=details&id=$1
RewriteRule ^add-site-(.*).html index.php?command=add_site&category=$1 |
THXS for any Help
Steve |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
Posted: Thu Sep 13, 2007 8:15 am Post subject: Re: mod_rewrite Help |
|
|
Given that the .htaccess will not change your URLs but will only allow them to work, the cat rewriterule you are searching for should be close to this :
| Code: | #categories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^links/([a-z0-9_-])+/?(index([0-9]+)\.html)?$ /links/index.php?command=select&category=$1&pager_cmd=$3 [QSA,L,NC] |
-http://www.webadress.net/links seems to be a real folder, so there is no need to add a rewriterule for it, it should load the default page.
The rewriterule mentions the links/ folder and should as is be implemented in the domains root .htaccess.
The three RewriteCond are here to make sure that we do not mess up with a physical file, since we are trying to match something like links/cattitle. We do not have a clear ending criteria (like .html or /), so the rewriterule will handle anything without dots in the links/ folder.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
stevan
Joined: 10 Sep 2007 Posts: 3
|
Posted: Thu Sep 13, 2007 12:09 pm Post subject: Re: mod_rewrite Help |
|
|
| I change the code to what you said and what happens now is the address is the same BUT when i click on a Cat I get a 404 |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
|
| Back to top |
|
 |
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |