mod_rewrite problem

Discuss practical ways rearrange URLs using mod_rewrite.

mod_rewrite problem

Postby mavoric » Sun Nov 21, 2004 10:32 am

Please help, i've posted this message and noone seems to be responding over there...

http://forums.devshed.com/t203050/s.html

Please post the replies here :) thanks
mavoric
 
Posts: 3
Joined: Sun Nov 21, 2004 10:28 am

Postby seomike » Mon Nov 29, 2004 8:44 pm

RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_URI} ^.*/comments/.*$
RewriteRule ^films/archive/([^/]+)/comments/([^/]+)\.html /films.php?film=$1&page=index&postid&boardid=$2 [L]

RewriteCond %{REQUEST_URI} !^.*/comments/.*$
RewriteRule ^films/archive/([^/]+)/index\.html /films.php?film=$1&page=index [L]


This wont redirect but it will keep the url in a static form ie
www.yourdomain.com/films/archive/move_name...

if you want it to redirect the just change the [L] to a [R=301]
for search engine optimization purposes I would leave the [L] :)
seomike
 
Posts: 331
Joined: Thu May 06, 2004 7:36 pm
Location: Dallas

Postby Guest » Tue Nov 30, 2004 7:22 am

erm im still having a problem with it, take a look...

http://www.filmshack.co.uk/films/archiv ... ts/20.html

and then the actual page...

http://www.filmshack.co.uk/films.php?fi ... boardid=20

both are giving out different responses, and its the mod_rewrite not giving out the correct values i think
Guest
 

Postby mavoric » Tue Nov 30, 2004 7:27 am

oops sorry didnt realise i wasnt logged in
mavoric
 
Posts: 3
Joined: Sun Nov 21, 2004 10:28 am

Postby seomike » Tue Nov 30, 2004 6:30 pm

Can you copy and paste exactly what you have in the .htaccess file :)
seomike
 
Posts: 331
Joined: Thu May 06, 2004 7:36 pm
Location: Dallas

Postby Guest » Wed Dec 01, 2004 10:59 am

Code: Select all
RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_URI} ^.*/comments/.*$
RewriteRule ^films/archive/([^/]+)/comments/([^/]+)\.html /films.php?film=$1&page=comments&postid&boardid=$2 [L]

RewriteCond %{REQUEST_URI} !^.*/comments/.*$
RewriteRule ^films/archive/([^/]+)/index\.html /films.php?film=$1&page=index [L]
Guest
 

Postby seomike » Wed Dec 01, 2004 2:54 pm

Code: Select all
RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_URI} ^comments/$
RewriteRule ^films/archive/([^/]+)/comments/([^/]+)\.html /films.php?film=$1&page=comments&postid&boardid=$2 [L]

RewriteRule ^films/archive/([^/]+)/index\.html /films.php?film=$1&page=index [L]


try this
seomike
 
Posts: 331
Joined: Thu May 06, 2004 7:36 pm
Location: Dallas

Postby mavoric » Thu Dec 02, 2004 6:16 am

ok it works now, i didnt realise it but there was a .htaccess file in the film folder, so i deleted it put in the old code and it worked.

Sorry for bothering you about that but thanks for giving the first bit of code to make it work

:)
mavoric
 
Posts: 3
Joined: Sun Nov 21, 2004 10:28 am

Postby seomike » Thu Dec 02, 2004 7:36 am

no problems :)
seomike
 
Posts: 331
Joined: Thu May 06, 2004 7:36 pm
Location: Dallas


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 29 guests

cron