I'll send $5 via paypal to whoever figures this out, first, and correctly. It must work on my server. It should be easy money for anybody familiar with mod rewrite, I just can't get it working: I have this URL I would like to rewrite it to I need the correct mod rewrite, or line of code for my htaccess file to make it work. Thanks.
unfortuntately I've already pulled my hair out looking at tutorials so I'm not too excited about reading another. Hopefully the $5 entices somebody with the skills to figure it out. thanks dave,
Assumming the only variable in the address is the numbers, try this RewriteRule ^folder/the_page-([0-9]+)[.]html$ /folder.php?whatpage=the_page-$1.html [L] Code (markup): I've only been using mod_rewrite for a week, so no guarantes.
numbers or letter in the variable, sorry for not clarifying. so could also be: I'm going to give your work a try now and report back shortly.
Try: RewriteRule ^folder/the_page-([A-Za-z0-9-]+)[.]html$ /folder.php?whatpage=the_page-$1.html [L] Code (markup):
actually "the_page" is a variable as well. so it could also be my_pages-abc123 I took what you had and tried to do put it all together but I get "can't find the page" now I get an internal 500 server error
This should do it. There are two variables in here ($PAGE-$NUMBER.html) RewriteEngine on RewriteRule ^folder/([^/]+)-([^/]+)[.]html$ folder/index.php?whatpage=$1-$2.html Code (markup): or in case.. RewriteEngine on RewriteRule ^folder/([^/]+)-([^/]+)[.]html$ /folder/index.php?whatpage=$1-$2.html [L] Code (markup):
basically I just want a pretty url So site.com/folder/index.php?whatpage=something_a1-b2.html into site.com/folder/something_a1-b2.html my index.php file grabs the "whatpage" variable and pulls it from my DB
I tried it and get this The requested URL /folder/gateway_fx530x-t.html was not found on this server. I don't know why it's not working that's why I'm asking. Your code is the only th ing in the htaccess file. the site is on dreamhost.
gotta sleep here. no pms on this, if there is a correct answer in the morning the first right one wins. thanks for trying guys and girls.
one more thing.... check whether the mod_rewrite module is installed .You will have to look on your phpinfo page. If you've not already created one of these for yourself, just copy and paste the following code into an new text file using text editor, save it as phpinfo.php , and upload it to your server: <?php phpinfo(); ?> Load that page up in your web browser, and perform a search for "mod_rewrite". All being well, you'll find it in the "Apache loaded modules" section of the page. If it isn't there, you'll have to contact your hosting company and politely ask them to add it to the Apache configuration.