i have been mucking around with this mod_rewrite and it still isnt working, this is what i would like to do http://supercarnews.com/brabus to go to this url http://supercarnews.com/makes.php?make=brabus (there are many makes, and i dont want to write out a rule for each make here is the code i have here RewriteEngine on Options +FollowSymlinks RewriteBase / RewriteRule ^\.htaccess$ - [F] RewriteRule ^/cars/(.*)/(.*)/(.*)$ /index.php?make=$1&car=$2 --> already being used for location of individual cars which works 100% RewriteRule ^/(.*)$ makes.php?make=$1 ErrorDocument 404 /index.php Code (markup): i would also like another line for the location of photos http://supercarnews.com/images/amg/s65/001 to goto this url http://supercarnews.com/viewimage.php?i=images/AMG/S65/AMG-S65-001.jpg i also have many many photos so writing in a seperate line for each link is not an option. any help would be greatly appreciated, thankyou
Two image versions. the simple version, or your version. Only use one of them, and the other rule might mess up the whole site. Adding .whatever (That you don't use.) or a fake directory would fix that. ErrorDocument 404 /index.php Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / #http://supercarnews.com/images/amg/s65/001 RewriteRule ^images/([^.]+)/([^.]+)/([^.]+)$ viewimage.php?i=images/$1/$2/$3.jpg [L] OR #http://supercarnews.com/images/AMG/S65/AMG-S65-001.jpg RewriteRule ^images/([^.]+)$ viewimage.php?i=images/$1 [L] and RewriteRule ^([^.]+)$ makes.php?make=$1 [L]
ok, thanks so much for your help, the makes part works perfectly except if i try to use the second images rule, thats when it all goes to sh|t, if i use the first rule, i cant view any of the actual car pages, they simply redirect to the makes page. the thing that is buggering everything up is the images part, is there another way to redo those images urls for better SEO?
The fake URL has to have something in it that none of the real URLs have or it freaks out. Like a fake extention that you don't use or a fake directory name. Are the images originally in /images/ ? (It looks like they are.) Using /pictures/ instead of /images/ in the fake URL would keep it from fliping out.
still having problems, it seems i can only use either the makes rewrite rule or the photos rewrite rule, as both of them together dont work. if i use both of them together, i cant actually get to any of the cars pages, just goes to the make of that cars page, below is what i have altogether which i want to work any more suggestions as you have been very helpful so far
RewriteRule ^([^.]+)$ makes.php?make=$1 [L] messes everything up, hince you need something unique there. RewriteRule ^([^.]+).html$ makes.php?make=$1 [L] html being something you don't use, or RewriteRule ^fakedirectory/([^.]+)$ makes.php?make=$1 [L]
ok i have the makes working fine with the following code but photos still a no no, even though there is a fake directory which isnt normally used. is there a problem with the flags maybe???
[L] goes at the very end of each line. (Space before [L] ) What does your complete .htaccess code look right now, and what's RewriteRule ^\.htaccess$ - [F] for?
currently looks like this RewriteRule ^\.htaccess$ - [F] that was what my brother had done previously (he is an insanely brainy php programmer, bit limited in htaccess though, but he is only 16) i think it actually forbids (the [F] flag) access to the htaccess file funnily enough, even with just those rewrite code lines, it still redirects the cars without a line of code, also my understanding of the [L] flag is for the final rule to follow
With only that, anything at /cars/ is a dead link so it goes to the index.php file. You also have to change the script to point to the new URLs. What's the domain name? ErrorDocument 404 /index.php RewriteEngine on Options +FollowSymlinks RewriteBase / RewriteRule ^photos/([^.]+)/([^.]+)/([^.]+)$ viewimage.php?i=images/$1/$2/$3.jpg [L] RewriteRule ^cars/([^.]+)/([^.]+)$ /index.php?make=$1&car=$2 [L] RewriteRule ^aston_martin$ makes.php?make=aston_martin [L] RewriteRule ^brabus$ makes.php?make=brabus [L] RewriteRule ^carlsson$ makes.php?make=carlsson [L] RewriteRule ^ferrari$ makes.php?make=ferrari [L] RewriteRule ^hamann$ makes.php?make=hamann [L] RewriteRule ^kleemann$ makes.php?make=kleemann [L] RewriteRule ^lamborghini$ makes.php?make=lamborghini [L] RewriteRule ^mercedes_amg$ makes.php?make=mercedes_amg [L] RewriteRule ^pagani$ makes.php?make=pagani [L] RewriteRule ^porsche$ makes.php?make=porsche [L] RewriteRule ^misc$ makes.php?make=misc [L]
thats why i said it was funny, thats all i have in my htaccess and the links at cars/ work, check it out on this link supercarnews.com/cars/kleemann/cls/Kleemann_CLS_50K_S8 i wonder why it is doing it??? ***EDIT*** The whole code above works perfectly, nothing inteferes with anything else. thankyou so much for your time and effort (and speed) of answering my questions.