Forum Moderators: phranque
http://example.com---root
http://example.com/ggrantfd
http://example.com/Affidmgr
http://example.com/jvfsap/jindex.html.
When testing, if .htacces is disabled
http://example.com/ggrantfd - error 500
http://example.com/jvsfap/jindex.html - error 404
http://example.com/Affidmgr - error 500
Some of my rules..
Options -MultiViews
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([^\.]*)?\.htm$ index.php?name=$1 [NC,L]
RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
RewriteRule .* - [E=HTTP_IF_NONE_MATCH:%{HTTP:If-None-Match}]
Any suggestions to prevent the autodirect is appreciated
Thanks
[edited by: jdMorgan at 10:30 pm (utc) on Nov. 29, 2009]
[edit reason] example.com [/edit]
You've got a lot of redundant code there, I hope you understand the code you're using...
Jim
Thanks for responding
I'm no .htaccess guru, but all the index files in the sub directories are php files.
the files noted as jindex.html was denoted for testing as an ordinary html file.
The code supplied is only partial.
Somewhere and somehow Apache is redirecting to the root index
Options -MultiViews
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]
#RewriteRule ^([a-zA-Z]+)\.html$ $1.php [L]
RewriteRule ^view\.php$ listing.php
#Handle alpha links, using number for page number when results are displayed
RewriteRule ^search-alpha-(.+)-([0-9]+)\.html$ search-alpha.php?letter=$1&page=$2
#Handle all category links. Static category text followed by ID, followed by path
#The "Category" text here needs to be changed if the language variable category is changed
RewriteRule ^Category\/(.+)/$ index.php?id=$1
RewriteRule ^Category\/(.+)/([0-9]+)\.html$ index.php?id=$1&page=$2
#Handle all location links. Static location text followed by ID, followed by path
#The "Location" text here needs to be changed if the language variable location is changed
RewriteRule ^Location\/(.+)/$ index_locations.php?id=$1
RewriteRule ^Location\/(.+)/([0-9]+)\.html$ index_locations.php?id=$1&page=$2
#Ignore any physical files
#Handle all listing links. Listing ID followed by listing name or corresponding pages.
RewriteRule ^out-([0-9]+)\.html$ listing_out.php?id=$1
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)\.html$ listing.php?id=$1
RewriteRule ^(.+)/gallery\.html$ listing_gallery.php?id=$1
RewriteRule ^(.+)/send-message\.html$ listing_email.php?id=$1
RewriteRule ^(.+)/send-message-friend\.html$ listing_email_friend.php?id=$1
RewriteRule ^(.+)/reviews\.html$ listing_reviews.php?id=$1
RewriteRule ^(.+)/add-review\.html$ listing_add_review.php?id=$1
RewriteRule ^(.+)/products-(.+)\.html$ listing_products.php?id=$1&type=$2
RewriteRule ^(.+)/documents\.html$ listing_documents.php?id=$1 [L]
</IfModule>
# handle links of affiliate Director 2.0
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/([a-z_\-]+)/?$ /ad2/redirect.php?site=$2 [NC,L]
ErrorDocument 404 /
ErrorDocument 403 /
ErrorDocument 500 /
RewriteEngine on
RewriteRule ^([^\.]*)?\.htm$ index.php?name=$1 [NC,L]
RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
RewriteRule .* - [E=HTTP_IF_NONE_MATCH:%{HTTP:If-None-Match}]
[edited by: jdMorgan at 10:31 pm (utc) on Nov. 29, 2009]
[edit reason] example.com [/edit]
This problem is not clear, so can we please have a couple of examples of typed-in URLs that you want to rewrite, what filepath they should be rewritten to (note: a filepath and a URL are not the same thing), and a description of what actually happens when you request those URLs -- to include any error messages found in your server error log file?
You've got several minor things that need to be improved in this code, but tweaking isn't likely going to fix the main problem, so that can wait.
Jim
There are multiple domains on the same webserver.
The domain example contains the root with index.php file
The subdirectory ggrantfd contains an unrelated application with a seperate index.php file as does the subdirectory
jvfsap
However the subdirectories are not being loaded and are all being redirected to the root.
Why?
http://example.com
http://example.com/ggrantfd
http://example.com/jvfsap
server logs return no related error info
however httpfox plug-in shows initial connection being re-directed 3 times.
1) 00:05:18.6510.215444239GET302Redirect to: http://www.example1.com/8c108tenm4/elq/3288539A/48BBB77/2/2/2?n=n<<r33z%3A%2F%2F666.3u0vrmo.myw%3AIAIA%2Fmvsmu-CGJJJFF-BAGGDBHI<<Q<r33z%3A%2F%2Fmromu-py1-s3.myw%2Fqq1kx3pn<http://www.tkqlhce.com/9t82uoxuowBEILLLHHBDCIIFDJK
2) 00:05:18.8750.193644262GET302Redirect to: http://www.example2.com/li122y1A9U/18D/RQWWTRXY/SWZZZVV/Q/YJK42ZPYQSYZRWTZPRSVZSQUWQUZRSPB4/Q?p=w<krw!4HG2-1nwsAA4s<p11x%3A%2F%2F444.1sytpkm.kwu%3AG8G8%2Fktqks-AEHHHDD-98EEB9FG<<O<p11x%3A%2F%2Fkpmks-nwz-q1.kwu%2Fooziv1nl<http://www.example2.com/8c108tenm4/elq/3288539A/48BBB77/2/2/2?n=n%3C%3Cr33z%3A%2F%2F666.3u0vrmo.myw%3AIAIA%2Fmvsmu-CGJJJFF-BAGGDBHI%3C%3CQ%3Cr33z%3A%2F%2Fmromu-py1-s3.myw%2Fqq1kx3pn%3C
3) 00:05:19.0780.187692262GET302Redirect to: http://www.example3.com?source=401010007&src=AACJhttp://www.example3.com/li122y1A9U/18D/RQWWTRXY/SWZZZVV/Q/YJK42ZPYQSYZRWTZPRSVZSQUWQUZRSPB4/Q?p=w%3Ckrw!4HG2-1nwsAA4s%3Cp11x%3A%2F%2F444.1sytpkm.kwu%3AG8G8%2Fktqks-AEHHHDD-98EEB9FG%3C%3CO%3Cp11x%3A%2F%2Fkpmks-nwz-q1.kwu%2Fooziv1nl%3C
the file path should be
/kunden/homepages/29/d197051712/htdocs/example/ggrantfd.
I not quite sure how the re-direct code is deciphered, but Apache appears to re-writing a 302 redirect which does not appear in the htaccess
thanks
[edited by: jdMorgan at 10:35 pm (utc) on Nov. 29, 2009]
[edit reason] example.com [/edit]
Once you've got the main problem identified, we can clean up your .htaccess code a bit, but your main problem is not in this file.
Jim