Hello everyone! I need lil' bit of help to convert some links: My site is in .php and I need to convert everything .php into .html index.php into index.html aboutus.php into aboutus.html and secondly I need to convert: http : // www . my-site. com / index.php?list=a into http : // www . my-site. com / list-a.html http : // www . my-site. com / index.php?list=b into http : // www . my-site. com / list-b.html http : // www . my-site. com / index.php?list=c into http : // www . my-site. com / list-c.html and so on... Your help will be highly appreciated! Thank you! (My .htaccess file is empty now)
You can open the pages in your browser, using view source. Then you copy that code into a new text file named ****.htm. Then you have your static .htm file, easy as that. If you already deleted your htaccess, you need to replace it to do this. If you can't recover that code then you have to re-write it, or else extract the data from your datastore and code the html by hand.
Goliath I tend to believe you don't know anything about PHP or .htaccess and it's better to just let others say important things, than filling non-sense... FYI: in PHP you can have some variables that will never work if the page is manually converted in html by just "view/copy/paste" source. Good luck with your life
Haha. That made me laugh. Below is what you'll need for the .htaccess file. I think he was saying you'll have to change the links in your PHP as well. Options -Multiviews RewriteEngine On RewriteBase / RewriteRule ^([a-z]+)\.html$ /$1.php [L] RewriteRule ^list-([a-z]+)\.html$ /index.php?list=$1 [L] Code (markup): If you're lazy like me and don't want to change them in your PHP, you can use this to force a redirect to the new URLs and still keep the same files: Options -Multiviews RewriteEngine On RewriteBase / RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule .* - [L] RewriteRule ^([a-z]+)\.php$ /$1.html [R=301,L] RewriteCond %{QUERY_STRING} ^list=([a-z]+)$ RewriteRule ^index\.php$ /list-%1.html? [R=301,L] RewriteRule ^([a-z]+)\.html$ /$1.php [L] RewriteRule ^list-([a-z]+)\.html$ /index.php?list=$1 [L] Code (markup):
Wow, I just noticed this. Harsh sentiments. For someone who posted this type of question you are quick to accuse me of being ignorant. If you put a PHP page on the server and then the php will execute, and you can then copy the static HTML generated by the PHP using the view->source function of the browser. I would make some pictures so you could understand the steps but I don't have the time to waste today. It's a basic PHP debugging technique. If you have never looked at the page source to see what was being generated by PHP code on the server than I think you should ease up on the name calling and derogatory remarks. geez. Glad to see you got a fix for your problem.
Options -Multiviews RewriteEngine On RewriteBase / RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule .* - [L] RewriteRule ^([a-z]+)\.php$ /$1.html [R=301,L] RewriteCond %{QUERY_STRING} ^list=([a-z]+)$ RewriteRule ^index\.php$ /list-%1.html? [R=301,L] RewriteRule ^([a-z]+)\.html$ /$1.php [L] RewriteRule ^list-([a-z]+)\.html$ /index.php?list=$1 [L] Code (markup): [/QUOTE] Hi chard Thanks for your info
Chad and Goliath, I specifically set up an account here just so I could thank you both. Both of your tips are very much appreciated. Thank you again.