|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Search Engine Optimization Forum SEO is much easier with help from peers and experts! The WebProWorld SEO forum is for the discussion and exploration of various search engine optimization topics. Any non (engine) specific SEO or SEM topics should go here. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello, I just redirected my non www URL to my www URL with the formula
RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com RewriteRule (.*) http://www.example.com/$1 [R=301,L] I put it in my .htaaccess file and it redirected my URL but, my website pictures were not showing up.(some type of browser problems) Does anyone know how to fix this? When I removed the formula my pictures showed again. It also caused a problem with my log-in to my shopping Admin. Thank you Projector Discount Store-LCD/DLP/Home Theater |
|
||||
|
Hi thersey,
Have you tried to set the HTTP_SERVER constant located in includes/configure.php to your url with the www? It appears as though you are using OSCommerce with an automated thumbnail generator and perhaps requiring it to redirect to the www domain through .htaccess is causing the problem. ~D
__________________
MODPlug Central | Free Music Software StudioKraft | Ecommerce Web Site Development |
|
||||
|
Quote:
<Directory /path/to/public_html/> RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteRule (.*) http://www.example.com/$1 [R=301,L] </Directory> which says (roughly): if the url does not begin with 'www.example.com' then rewrite it to www.example.com/<whatever follows> Your example says (roughly) if the URL begins with 'example.com' rewrite it to 'www.example.com' but you have nothing handling anything following the 'example.com' (that is what the "$" is for). In other words, if I entered 'example.com/somethingelse' I would get redirected to 'www.example.com' - not 'www.example.com/somethingelse'; which is the desired result :/ Also, your logic is kind of wrong. Your line says, "if it begins with example.com rewrite to www.example.com" whereas you are probably better served saying "if it does not begin with 'www.example.com' rewrite to www.example.com". The '^' refers to "begins with" and the "!" refers to does not - ie. "!^" says "does not begin with". I am farily certain you want to change: RewriteCond %{HTTP_HOST} ^example.com to: RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] This is not a browser problem -- it is acting *exactly* as you told it to |
|
||||
|
Two things about the above comment. First, redirect match terms are "greedy" - if you don't specify text, text will be allowed.
RewriteCond %{HTTP_HOST} ^example.com RewriteRule (.*) http://www.example.com/$1 [R=301,L] will match example.com, example.com/index.php, etc but not Example Web Page. The ^ specifies the beginning of the string. RewriteCond %{HTTP_HOST} ^example.com$ RewriteRule (.*) http://www.example.com/$1 [R=301,L] Will ONLY match example.com. This is because ^ represents the beginning of the string and $ matches the end of the string. However, HTTP_HOST does not have anything after the hostname (which is the domain name) so this method would work The problem is your rewrite rule, not the condition. If someone goes to example.com/img/pic.jpg, you are redirecting them to www.example.com//img/pic.jpg (note the extra slash). The rewrite rule should be rewritten as: RewriteRule /(.*) http://www.example.com/$1 [R=301,L]
__________________
The best way to learn anything, is to question everything. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 301 redirect? | watto | Search Engine Optimization Forum | 8 | 08-02-2006 10:41 AM |
| 301 Redirect | tonya1 | Search Engine Optimization Forum | 16 | 08-31-2005 04:12 PM |
| Redirect 301 | jeannemalherbe | Search Engine Optimization Forum | 4 | 11-16-2004 04:40 AM |
| 301 redirect - which is best | groenie | Search Engine Optimization Forum | 8 | 10-07-2004 06:46 AM |
| 301 redirect help | Blayne | Google Discussion Forum | 11 | 05-04-2004 12:13 AM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |