phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
mod_rewrite Help

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » Apache mod Rewrite
::  
Author Message
stevan



Joined: 10 Sep 2007
Posts: 3

mod_rewrite HelpPosted: 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
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

mod_rewrite HelpPosted: 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
Visit poster's website
stevan



Joined: 10 Sep 2007
Posts: 3

mod_rewrite HelpPosted: 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
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

mod_rewrite HelpPosted: Fri Sep 14, 2007 7:56 am    Post subject: Re: mod_rewrite Help

dcz wrote:
Given that the .htaccess will not change your URLs but will only allow them to work


The .htaccess only makes it possible to use rewritten URLs, it does not alter the links outputted. This is to be done in your script.

++

_________________
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
Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » Apache mod Rewrite
Page 1 of 1

Navigation Similar Topics

Jump to: