Forum Moderators: phranque
I'm trying to rewrite to
[/mysite.com/ea/products.php?parameters=$parameters...]
In my php script I parse out the $parameters which usually end up as
ea/category/
ea/category/subcategory/
ea/category/subcategory/product.html
Here is the .htaccess I was using to do this. I placed it in the /ea/ folder.
RewriteEngine on
rewritebase /ea
RewriteRule (.*)/(.*) products.php?parameter=$1/$2
I pretty much got it to work with trial and error.
I don't quite understand the rewritebase
I tried to figure it out at
httpd.apache.org/docs/mod/mod_rewrite.html
And now for the tricky part.
I wanted to take a url like this
[/mysite.com/ea/special/some-thing/...]
and send it to
[/mysite.com/ea/special.php?keywords=$1...]
I created the .htaccess like this:
RewriteEngine on
rewritebase /ea
RewriteRule (.*)/(.*) products.php?parameter=$1/$2
RewriteRule topitems/(.*) special.php?keywords=$1
The problem is that this new url seems to be following the first rule.
I tried reversing the order of the rule and just about every iteration of
slashes and wildcards I could.
To tell the truth I think I need to come up with a whole new .htaccess
As I've said I've gotten this exact same setup to work when the site is at the root.
For use in .htaccess, the following code should work. Be sure to flush your browser cache (Temporary Internet Files) before testing a new set of rewriterules. Otherwise, the page will be fetched from your cache and not from the server. In that case, your rewriterules can have no effect. You may have to force a reload if your ISP caches pages as well -- Use control-reload or shift-reload, depending on the browser you're using.
RewriteEngine on
RewriteBase /ea
RewriteRule ^topitems/(.*) /special.php?keywords=$1 [L]
RewriteRule ([^/]*)/(.*) /products.php?parameter=$1/$2 [L]