My website has around 500 pages that used to be html. Because the host decided to change the way php functioned, I could no longer parse html as php. The problem is that almost all of the pages in the website have php includes. If I can not parse html as php, my headers, footer, and side bar are not shown.
My solution after trying to resolve it other ways was to just upload copies of all of the html files with the extension changed to .php and do a global redirect in my htaccess.
This solved the major problem, but created a couple of minor ones.
Some of the pages in the site that I do not want redirected are being redirected {a couple of forum pages and the 404.shtml error page}.
How do you guys think I could solve this? My current idea is to eliminate the global redirect and upload an htaccess with individual redirects for all of the 500 pages in the website. I can probably do that in notepad in 10 minutes. My concern is that the browsers or the server might not like a 500 line htaccess file.
It’s probably easier to create an exception for the global redirect to spell all the redirects out manually.
Eg.
RewriteEngine On
# if the request is not for /forum or /someotherpath ...
RewriteCond %{REQUEST_URI} ^/forum [OR]
RewriteCond %{REQUEST_URI} ^/someotherpath
# ... redirect
# <insert your global redirect rule here>
Does that help or did I misunderstand your question?
Well, that’s pretty much what I put in my last post, but modified slightly:
RewriteEngine On
# if the request does not start with /forums/ and the request is not for /404.shtml ...
RewriteCond %{REQUEST_URI} ^/forums/ [OR]
RewriteCond %{REQUEST_URI} ^/404\\.shtml$
# ... redirect
# <insert your global redirect rule here>
Out of curiosity, what is your global rewrite rule?
Now do not laugh but I know nothing of rewrite rules. In fact, I was never any good with anything related with site hosting, servers or even design. Lets just say that I wrote every page using tables.
Second, a global rename of your files is possible via a shell - but this would be ugly. It would also require a simple substitution RewriteRule to change the .html to .php and could be invisible or 301’s to the world.
Third, INDIVIDUAL REDIRECTS? Horrors! The first thing to learn about .htaccess is NOT to use it unless absolutely necessary. While it is necessary in your case (until you ditch that host and get a good one), creating a huge file which must be read and parsed multiple times for every file request is an abuse of the server (and even your bad host should give you the boot for that). Option two above is far better than a long list of Redirect statements but Option 1 will do the job for you very simply.
Rémon,
You forgot the ! in both the directory and file RewriteCond statements (which then should be ANDed) as you only want to redirect is NOT A AND NOT B.