Forum Moderators: phranque
[url]http://www.example.net/hollywood-movies-zone/[/url]
when i click a broken image's properties, i can clearly notice a wrong rewrite url i.e
http://www.example.net/hollywood-movies-zone/images/colortheory/misc/navseperator.gif
Infact it should look like this instead which is correct location of img:
http://www.example.net/images/colortheory/misc/navseperator.gif
Is it a problem with my .htaccess or vbseo setting please help.I m using vbseo default rewrite setting.Here is the .htaccess rules i m using:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.example\.net
RewriteRule (.*) http://www.example.net/$1 [L,R=301]
RewriteRule ^((urllist¦sitemap_).*\.(xml¦txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
RewriteCond %{QUERY_STRING} !vbseourl=
RewriteCond %{REQUEST_URI} !(admincp/¦modcp/¦chat¦cron)
RewriteRule ^(.*\.php(/.*)?)$ vbseo.php?vbseourl=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !\.(jpg¦gif)$
RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(admincp¦modcp¦clientscript¦cpstyles¦images)/
RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]
-------------------------------------------------------------
Thanks in advance
[edited by: jdMorgan at 4:30 pm (utc) on June 12, 2008]
[edit reason] example.net [/edit]
RewriteCond %{REQUEST_FILENAME} !^(admincp¦modcp¦clientscript¦cpstyles¦images)/
RewriteCond %{REQUEST_URI} !^/(admincp¦modcp¦clientscript¦cpstyles¦images)/
For efficiency's sake, put this RewriteCond ahead of the other two, so as to avoid unnecessary calls to the filesystem to check for file-and-directory exists; These are *very* slow operations compared to Apache-internal operations, and should be avoided whenever possible.
Replace all broken pipe "¦" characters with solid pipes before use; Posting on this forum modifies the pipe characters.
Jim
Actual problem is still not sorted out buddy. I m using vBseo as my URL rewriter.
Wht exactly is happening is tht its replacing/rewriting:
www.example.com/Thread-Title-As-Url/images/colortheory/misc/image.file
Wht i m intending to do is to remove tht thread-title-As-Url from the image Url which is a wrong location. Now i can prevent images folder url to be rewritten but how can i prevent anything before it.
My VB skin's image location is images\colortheory\
Its getting all other .gif files from the right location like example.com\images\colortheory\buttons\newthread.gif etc. as i look at the image properties.
Here is the new .htaccess i m using after ur advice.I still didnt figured out where exactly is the problem, in vBseo setting or .htaccess.
Please tell me wht else should i add to this file & wht should be its location in the file:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.example.com
RewriteRule (.*) http://www.example.com/$1 [L,R=301]
RewriteRule ^((urllist¦sitemap_).*\.(xml¦txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
RewriteCond %{QUERY_STRING} !vbseourl=
RewriteCond %{REQUEST_URI} !(admincp/¦modcp/¦chat¦cron¦image)
RewriteRule ^(.*\.php(/.*)?)$ vbseo.php?vbseourl=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !\.(jpg¦gif)$
RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]
RewriteCond %{REQUEST_URI} !^/(admincp¦modcp¦clientscript¦cpstyles¦images)/*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(admincp¦modcp¦clientscript¦cpstyles¦images¦colortheory)/
RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]
------------------------------------------------------------------
Now this problem is killing me :'(
is there any way tht i confine the site to fetch all my .gif from a static path?
You code appears to have several "little errors" in it, and you have not made the corrections that I suggested above. Please understand that the contributors here are all volunteers, and that we're talking about your site here; It's your responsibility to learn enough about mod_rewrite to fix it. While mod_rewrite may seem trivial and unworthy of time investment, I must point out that it is a server configuration file -- That is to say, it *must* be correct, or you will have many problems. One single typo can cause unexpected operation or intermittent errors at best, and a total loss of your search engine rankings at worst.
However, if you have no interest in learning the nitty-gritty of mod_rewrite and serve config, I'd recommend hiring a consultant to fix your server -- and having said so, recuse myself from that pool on the basis of conflict of interest.
Now, although the problem appears to be caused by a problem with how vbseo constructs links on your pages, it is possible to "put a band-aid" on the problem by using mod_rewrite to "re-connect" the bad URLs with the proper file locations on the server. I call this a "band-aid" because it does not cure the original problem -- it is only a work-around. And additionally, it causes a problem itself: Each image on your server will end up with an essentially infinite number of URLs, a problem in the duplicate-content class, and a potential point of exploitation by your competitors, detractors, or just wise-guys...
Let's clean this up a bit first, and then address the band-aid:
RewriteEngine on
# removed default/redundant "RewriteBase /"
#
# escape all literal periods in regex patterns
RewriteCond %{HTTP_HOST} !^www\.exampl[b]e\.c[/b]om
RewriteRule (.*) http://www.example.com/$1 [L,R=301]
#
RewriteRule ^((urllist¦sitemap_).*\.(xml¦txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
#
# add leading slash to 2nd RewriteCond, as previously noted
RewriteCond %{QUERY_STRING} !vbseourl=
RewriteCond %{REQUEST_URI} [b]!/(a[/b]dmincp/¦modcp/¦chat¦cron¦image)
RewriteRule ^(.*\.php(/.*)?)$ vbseo.php?vbseourl=$1 [L,QSA]
#
RewriteCond %{REQUEST_FILENAME} !\.(jpg¦gif)$
RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]
#
# fix last RewriteCond and move it to the top as previously noted -- but
# there now seems to be partial duplication with the first? Pick one.
RewriteCond %{REQUEST_URI} !^/(admincp¦modcp¦clientscript¦cpstyles¦images)/
RewriteCond %{REQUEST[b]_URI[/b]} [b]!^/(a[/b]dmincp¦modcp¦clientscript¦cpstyles¦images¦colortheory)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.+) vbseo.php?vbseourl=$1 [L,QSA]
What you apparently need to do is to drop the initial part of the URL-path for image requests if the second URL-path-part is "/images". Easy enough with a single rule, inserted above the final rule in the code block above:
RewrteRule ^[^/]+/(images/([^/]+/)*[^.]+\.(gif¦jpe?g))$ /$1 [L]
So, the rule takes a request for the URL
/<any-initial-dir>/images/<any-number-of-dir-levels/<image-name>.<gif, jpg, or jpeg> and rewrites
it to the filepath /images/<any-number-of-dir-levels/<image-name>.<gif, jpg, or jpeg>
As stated above, you can use this to get your site working temporarily, but I cannot recommend it as a long-term fix -- Look to the vbseo code (and possibly to their help forum) to find the root cause of the incorrect image URLs on your pages.
Jim
But this doesn't fixed my problem. I m a PHP expert n i solved it in another manner. I change the way my vBulletin's template calls for image. I changed all image calls from src="images/colortheory/misc/example.gif" to this src="$stylevar[imgdir_misc]/example.gif
everything is fixed now and many thanks to all u guys once again. Keep up the good work.