I am rebuilding a new website for a company and they already have a .htaccess file with the following code in it:

RewriteEngine on
RewriteCond %{REQUEST_URI} !(/liens_photos/20091111|images/olympique07/) [NC]
RewriteRule (.*)\.html? /$1\.php [L]

Unfortunately I am very new with this and I want to know what this code does exactly... I really don't want to crash the website...

Thanks :)

Recommended Answers

All 7 Replies

This .htaccess code allows any uri posted to the html filename in the folder given, to work transparently with the new php system
everything before the extension .html gets posted as $1 to $1.php
old links old bookmarks still work

So basically it's nothing really relevant for the website to function correctly? Because I'm starting from sratch and all the current pages will be erased and replaced with new ones... So I won't really need that .htaccess file, will I?

This has little to do with your NEW site, and much to do with preservation of the old site bookmarks
IF a significant number of customers, google, other search engines, backlinks, paid advertising, link to those old file names, the customer will be substantially annoyed if all their existing links fail, with loss of sales, and SER reduction
they will blame you
building from scratch and erasing all current pages is often not an option,
without implementing a system of remapping.
this is what the prior person did with that single .htaccess entry when the client moved from static pages to php
given the above, a 'did you mean new file chosen from a php function of likely candidates please update your bookmarks' is often sufficient,
as is a .htaccess entry that redirects all old files to the new menu system with 301 moved

but is something you should discuss with the client before implementing any alterationwhich also makes it appear you have a tight grasp on the concepts behind seoto cover your behind from later recriminations
and something you should not ignore

I see... Even if the customer is changing their domain name? Is it still applicable?

If yes, then do I need to change anything in the .htaccess file? Because I really need to start from scratch as the old website is unbelievably ugly and has way too many pages and too many directories.

Thank you so much for your help!!!

Changed domain name makes it really simple, you can throw away everything, and use a single redirect in the old domain name for a few months to the new menuing system
Your OP said nothing about new domain, sorry all my prior stuff is unneeded

just ask them to keep the old domain name for long enough for google & other se to update links, expired domains are a big business among spammers etc
rewrite code to new domain name

RewriteCond %{REQUEST_URI} ^$
RewriteCond %{HTTP_HOST} ^olddomain.com$
RewriteRule ^$ http://www.newdomain.com/[L,R=301]

Yes sorry that was my fault!

Ok wow this is great thank you for your help, yuo have made my day (much probably my whole week)!

this set of links will help

http://analyze.websiteoptimization.com/authenticate.php?url=http://www.yoursite.com&/ Speed tweaks

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.yoursite.com&charset=%28detect+automatically%29&doctype=Inline&group=0 html check

http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.yoursite.com&profile=css21&usermedium=all&warning=1&lang=en CSS2 check http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.yoursite.com&profile=css3&usermedium=all&warning=1&lang=en CSS3 check

http://demo.opera-mini.net/demo.html?www.yoursite.com handheld

http://www.browsershots.org other browsers
many problems (if present) will show
serious code errors in the w3c validator sites will produce blankscreens in browsershots

Valid code does not ensure the site will work ...
Invalid code ensures the site will not work ...
.. in all browser OS combinations

not all layouts work in handheld devices
set it up in em & %, not px or pt, makes auto adjusting pages that fit most screen and window sizes in most devices

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.