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]
([^/]+/)* pattern in the code. The password protection on your test site is very important. You don't want Google indexing and ranking those pages (duplicates, test pages, experiments), so keep all search engines out.
and it gives me 404 on the main url and all subdirectories
if i use http://www.example.com/index.php i do get the correct page, but any http://www.example.com or with a subdirectory/ i get the 404
where am i going wrong?
[edited by: jdMorgan at 1:18 pm (utc) on Mar. 10, 2009]
[edit reason] RewriteCond pattern corrected as noted below. [/edit]
If i try to call a index.html it gives me a 404 but if i call a inex.php its fine and just a subdirectory/ is fine
i need to redirect any .html called paged to the folder/ so the new index.php pages can be found
does that make any sense (im so confused)(help)
DirectoryIndex should list the real filename where the content resides. To redirect both index.html and index.php to / for both root and for folders, change the \.html or the \.php to this:
\.(html?如hp[45]?吆aj]spx?) or similar. That will redirect all of the index URLs to strip off the filename leaving the URL to end the folder name with a trailing slash.
.
If you need to also redirect other .html URLs back to the folder level, you'll need a separate rule for that too. This one will need to allow a wildcard for the filename and have just .html for the allowed extension in the pattern.
this it what i up loaded
Directoryindex index.php
#
# redirect all <subdirectory>/index.html requests to <subdirectory>/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(html?如hp[45]?吆aj]spx?)$ http://www.example.com/$1 [R=301,L]
and if i try to get folder/index.html i still get a 404 instead of being redirected back to the folder/
im so lost
[edited by: jdMorgan at 1:18 pm (utc) on Mar. 10, 2009]
[edit reason] RewriteCond pattern corrected as noted below. [/edit]
Directoryindex index.php
#
# redirect all <subdirectory>/index.html requests to <subdirectory>/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(html?如hp[45]?吆aj]spx?)\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(html?如hp[45]?吆aj]spx?)$ http://www.example.com.com/$1 [R=301,L]
im still getting 404 s with this when i try http://www.example.com/index.html or http://www.example.com/folder/index.html
if i use index.php i get the page
[edited by: jdMorgan at 3:17 pm (utc) on Mar. 10, 2009]
[edit reason] RewriteCond pattern corrected as noted below. [/edit]
Ive tried it sevral ways on the make in textedit and had it work one time. i cant seam to duplicate it.
so i went to a friends house to try his pc using notepad and clasic ftp and still can't get the first code working
I must really be doing something majorly wrong
any idea's
please help thanks
paul
those are my last errors im using godaddy to host its a linex(is that spelled right) server
im sorry to keep bothering you guys, but i really dont know where else to turn for this
Paul
Options +FollowSymLinks
RewriteEngine on
#
RewriteRule ^foo\.html$ [google.com...] [R=301,L]
that one is working
this one Im not sure about
Directoryindex index.php
#
# redirect all <subdirectory>/index.html requests to <subdirectory>/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(html?如hp[45]?吆aj]spx?)\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(html?如hp[45]?吆aj]spx?)$ http://www.example.com.com/$1 [R=301,L]
that one being i really don't know what the script should do Im not sure its working
if i type http://www.example.com or http://www.example.com/ or even http://www.example.com/index.php i get the correct page how ever if i type http://www.example.com/index.html i get a 404 i want it to go back to the root or the folders root
will that code do it?
Paul
[edited by: jdMorgan at 1:20 pm (utc) on Mar. 10, 2009]
[edit reason] RewriteCond pattern corrected as noted below. [/edit]
Are there any intermediate codes sent back before the 404, or is the 404 in the very first response?
You'll also likely need to remove the / highlighted here:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*[b]/[/b]index\.(html?如hp[45]?吆aj]spx?)\ HTTP/ [edited by: jdMorgan at 1:21 pm (utc) on Mar. 10, 2009]
[edit reason] This is the correction to code posted above. [/edit]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)[b]*/i[/b]ndex\.(html?如hp[45]?吆aj]spx?)\ HTTP/ RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(html?如hp[45]?吆aj]spx?)\ HTTP/
Jim
[edit] Clarification of correction noted above. [/edit]
[edited by: jdMorgan at 1:23 pm (utc) on Mar. 10, 2009]
I am confused as to why one code would work but this one seams to do nothing at all.
Am I Missing something on the .htaccess page?
Directoryindex index.php
#
# redirect all <subdirectory>/index.html requests to <subdirectory>/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(html?如hp[45]?吆aj]spx?)\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(html?如hp[45]?吆aj]spx?)$ [my-url.com.com...] [R=301,L]
thats everything on the whole .htaccess
Make sure you change the ¦ pipe ¦ symbols back to be solid pipes (not the broken ones shown in the forum).
Flush your browser cache before testing. The cache will still contain the old error page.
What can I do?