Welcome to WebmasterWorld Guest from 54.83.93.85

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Applying mod rewrite to files in folders

     
3:35 pm on Nov 25, 2010 (gmt 0)

Junior Member

10+ Year Member

joined:June 26, 2008
posts:178
votes: 0


Hey Peeps,
Mod_rewrite isn't one of my strong points and I've recently been doing a lot of discovery and now I'm stuck.

I want the following code to work from the root directory.

# /search term / category id / manufacturer id / page number
RewriteRule ^/?([a-zA-Z0-9_]+)/([0-9_]+)/([0-9_]+)/([0-9_]+)$ index.php?c=$1&cat=$2&man=$3&p=$4 [L]


It works a treat inside the required folder. However, I can't get it to work from the root, as mentioned.

I've tried a couple of things, such as the following:

# /search term / category id / manufacturer id / page number
RewriteRule ^advanced_search/([a-zA-Z0-9_]+)/([0-9]+)/([0-9]+)/([0-9]+)$ advanced_search/index.php?c=$1&cat=$2&man=$3&p=$4 [L]


But I have to be honest... I don't completely understand how this works and can't solve my problem.

This is my file structure:

root
- .htaccess
- /advanced_search
--- index.php

Any help people could offer would be greatly appreciated!

Cheers,
Tom.
9:01 pm on Nov 25, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


What does "does not work" mean?

What URL did you test?
What was the result?
What HTTP status code was returned? (Use Live HTTP Headers to check this.)
5:36 pm on Dec 1, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Assuming that the "/advanced_search" subdirectory and this .htaccess code are both located in the top-level directory, then your code should have worked. Did you delete your browser cache before testing in order to avoid seeing stale/cached server responses?

Jim
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members