Forum Moderators: phranque
Please help i am so lost with this
Thanks
[edited by: jdMorgan at 4:40 am (utc) on Mar. 5, 2009]
[edit reason] No URLs, please. See Terms of Service. [/edit]
You've got a trivially-simple project here, and it's likely that it can be solved with one line (or just a few lines) of code.
The first thing we need to know is, do you really need a redirect? You could just simply keep *linking* to .html URLs, but *serve* .php files when .html URLs are requested. The advantage is that none of your inbound links need to change, old bookmarks will still work, and search engines will see no difference in your site unless you changed the content of pages or their URL/names (other than changing .html to .php, that is).
What do you want to do?
Jim
First, create a plain-text (US-ASCII or UTF-8) file on your PC named "htaccess.txt" and put this in it:
Options +FollowSymLinks
RewriteEngine on
#
RewriteRule ^foo\.html$ http://www.google.com/ [R=301,L]
Once the file is on your server rename it to ".htaccess"
Now request the page /foo.html on your site... You should end up at google. If not, report back what you see, and if you get a server error, please report the relevant contents of your server error log.
Jim
Please contact the server administrator, support@supportwebsite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Also, please post the one or several entries from your access log that correspond to the same time as those in the error log.
Jim
ok the 500 error is back here is the error code
Im really confused now
Paul
Hi Jim I can't believe that something like this could be so hard to do I have used textedit in almost every possible combination from ascii to utf-8 have tried every way to up loaded it and all i keep getting are those 2 codes you see above. I just dont know what to do Please help
[edited by: jdMorgan at 10:29 pm (utc) on Mar. 8, 2009]
[edit reason] example.com [/edit]
OK Im sorry I got it now it sent me to that page in google above Im liking it, what is next?
I have changed your code to redirect my index.html page back to http://www.example.com/ and it works well, but now i need to redirect all of the index.html pages in all of the folder back to their main folders as well.
ex. from http://www.example.com/folder/index.html
to http://www.example.com/folder/
how can i do that i have dozens of these folders all used to have index.html now contain index.php
is there a way to do them all from that one .htaccess page or should i place an .htaccess page in each folder?
Im not sure how it work. Help Thanks
[edited by: jdMorgan at 10:27 pm (utc) on Mar. 8, 2009]
[edit reason] example.com [/edit]
[google.com...]
For a local PC copy, enter some invented hostnames in the HOSTS file (so that they will resolve to your local copy of Apache) and then try things out.
Never experiment with a live site in case you fatally break something while searchengines are indexing it.
My site that Im trying to fix was set up with all index.html pages and one or 2 folders even contain index.html index2.html etc now everything on the site is .php so i think this code i found on your link may take care of some of it, what do you think?
Directoryindex index.html
#
# redirect all <subdirectory>/index.html requests to <subdirectory>/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html$ http://www.example.com/$1 [R=301,L]
does<subdirectory> need to be named? iI have dozens of sub folders
right now Im using this code Jim gave me
Options +FollowSymLinks
RewriteEngine on
#
RewriteRule ^index\.html$ http://www.example.com/ [R=301,L]
and it is properly resending anyone who trys to call the doamin via the index.html page over to the new index.php
the only problem is that it isn't writen to do sub directories and it is sending everyone back to one page and not to the subdirectory itself (does that make any sense?)
as to setting up a password? Again I have no idea, if google indexes it, is that bad?
I am really new please excuse me if these questions are in any way dumb
thanks,
Paul
[edited by: jdMorgan at 1:17 pm (utc) on Mar. 10, 2009]
[edit reason] RewriteCond pattern corrected as noted below. [/edit]