|
|
||||||
|
||||||
| 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 |
|
|||
|
I tried a 301 redirection to my blog with the below script;
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*)\.magnuslator\.com$ [NC]
RewriteRule ^(.*)$ http://www.magnuslator.com/weblog/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*)\.www\.magnuslator\.com$ [NC]
RewriteRule ^(.*)$ http://www.magnuslator.com/weblog/$1 [R=301,L]
|
|
|||
|
I am redirecting only Magnus Lator & magnuslator.com to Magnus Lator. But I have been able to retify the problem. It was from wordpress General Options. The url was set as Magnus Lator instead of Magnus Lator
|
|
|||
|
I am having problem with this .htacess script;
RewriteEngine On RewriteCond %{HTTP_HOST} !^(.*)\.mysite\.com$ [NC] RewriteRule ^(.*)$ http://www.mysite.com/f/$1 [R=301,L] RewriteEngine On RewriteCond %{HTTP_HOST} !^(.*)\.www\.mysite\.com$ [NC] RewriteRule ^(.*)$ http://www.mysite.com/f/$1 [R=301,L] The problem is it tries opening http://www.mysite.com/f/f/f/f/f/fffffffff/f/f/f/f/f/f/ in this case the /f is being repeated. |
|
|||
|
I would try this:
Code:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mysite\.com$
RewriteRule ^(.*)$ http://www.mysite.com/f/$1 [L,R=301]
RewriteRule ^f\/ - [L]
RewriteRule ^(.*)$ http://www.mysite.com/f/$1 [L,R=301]
Jean-Luc |
|
||||
|
Two things. First, you are combining two redirects that need to be seperate, second, do you actually have sub-subdomains?
RewriteEngine On # First, force everything to the www. subdomain RewriteCond %{HTTP_HOST !^(.*)\.mysite\.com$ RewriteRule ^(.*)$ http://www.mysite.com/ [R=301, L] # Then rewrite all requests so that they go to the /f/ folder. RewriteCond %{REQUEST_URI} !^/f/ RewriteRule ^/(.*)$ http://www.mysite.com/f/$1 [R=301, L]
__________________
The best way to learn anything, is to question everything. |
|
|||
|
For now I want all request to be redirected to the F directory with www site. The same 301 redirect script was used on one of my sites and it worked perfect. But in this case it opens /f/f/f/f/f/f/
|
|
|||
|
That's because of the recursion here:
Code:
RewriteCond %{HTTP_HOST} !^(.*)\.www\.mysite\.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/f/$1 [R=301,L]
Jean-Luc |
|
||||
|
I think with older versions of Apache, the RewriteEngine on directive acted as kind of a reset of the rules. The thing to remember is that {HTTP_HOST} never contains anything but the domain/subdomain. So for your second rule, where you are trying to test the requested path, that will never be contained in the host line. A request for a page on your site looks like the following:
GET /somefolder/somepage.html Host: www.somedomain.com To test what folder the user is requesting, you need to use the value on the GET (or if form data is being submitted, POST) line, which is in the {REQUEST_URI} variable for mod_rewrite. You also are not testing if the user is already in the /f/ folder, which is why the user gets stuck in an endless loop.
__________________
The best way to learn anything, is to question everything. |
|
||||
|
Jean-Luc, just to make sure I am reading your rules correctly:
RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ #you are testing for the proper domain RewriteRule ^(.*)$ http://www.mysite.com/f/$1 [L,R=301] #You are sending the user to the correct domain RewriteRule ^f\/ - [L] #If the user is already in the f folder, you stop redirecting RewriteRule ^(.*)$ http://www.mysite.com/f/$1 [L,R=301] #Otherwise you send the user to the f directory If that is correct, I see a potential problem. If somehow the www. gets dropped from an otherwise valid link, the user will get an extra /f/ directory. In other words, a request to domain.com/f/page.html would redirect to www.domain.com/f/f/page.html. I would remove the /f from the second line, separate detection of the subdomain from detection of the folder.
__________________
The best way to learn anything, is to question everything. |
|
|||
|
Wige,
I agree. Your remark is valid, but I believe that magosla2001 will never get hits on the f directory in other subdomains (I got the impression that the f directory was recently created), but I can be wrong. Jean-Luc |
|
||||
|
Jean-Luc,
I definitely agree, it is unlikely, but just suggest it because it will provide a small amount of future proofing. You never know when a spider might get a URL wrong for some reason, (Slurp, for example) or a webmaster in the future leaves a www off an inbound link.
__________________
The best way to learn anything, is to question everything. |
|
|||
|
Absolutely right. You cannot be too careful.
Jean-Luc |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 301 Redirect | wmrobwl | Search Engine Optimization Forum | 3 | 09-18-2006 05:08 PM |
| Geo Redirect | jacobwissler | Google Discussion Forum | 0 | 08-22-2006 03:33 PM |
| 301 redirect? | watto | Search Engine Optimization Forum | 8 | 08-02-2006 10:41 AM |
| more redirect help plz!!! | roam_dx | Search Engine Optimization Forum | 4 | 07-11-2005 01:20 AM |
| 301 redirect and PR | mantawebsolutions | Search Engine Optimization Forum | 0 | 10-07-2004 03:46 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 |