Welcome to WebmasterWorld Guest from 3.84.130.252

Forum Moderators: ocean10000

Message Too Old, No Replies

How to Redirect using 301

     
4:54 pm on Oct 29, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Aug 30, 2007
posts: 690
votes: 6


Firstly., apologies for adding this post elsewhere in the wrong section.. maybe an administrator could delete the other post? or move it here?

I have a Windows PLESK II server where my website is hosted and I would like a 301 redirect for all of the website urls with NON www to all go to WITH www - currently they are both displaying...

ie.. http://example.com to redirect to http://www.example.com

I have read elsewhere that if the following is added to the .htaccess file then it should work but it doesn't...

RewriteEngine on
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]

I have been told that the servre has a ISAPI Redirect in place...

I do also have the following in the htaccess file..
# BEGIN wordpress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_fileNAME} !-f
RewriteCond %{REQUEST_fileNAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END wordpress

I guess the above was added for ther wordpress blog to work ok (this is vital)

Can anyone help?

[edited by: Ocean10000 at 2:37 am (utc) on Oct 30, 2011]
[edit reason] Broke Example Links. [/edit]

5:27 pm on Oct 31, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


As I understand it, Windows servers do not use an .htaccess file - that's an Apache thing. The later versions of the ISAPI Rewrite module, if installed, do allow .htaccess SYNTAX, but you would need access to the ISAPI Rewrite module... that is, you can't just place a file called .htaccess at the domain root and have it be functional.

I'd check in with whoever told you about the ISAPI Rewrite module and learn more about how you can use it on your hosting agreement.
7:33 pm on Oct 31, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 24, 2002
posts:894
votes: 0


You will need to find out from your host which version of ISAPI Rewrite is installed on the server.

Version 2 uses an httpd.ini for all rules and rewrites and
Version 3 uses an .htaccess file
4:06 am on Nov 1, 2011 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11684
votes: 205


you must first describe precise and completely what you are trying to accomplish with rewrites and redirects (they are different functions) and then make sure you know exactly what each character in those rules is doing.

i'm guessing that the scheme and hostname canonicalization rules won't really do what you are intending.
specifically the secure protocol part looks sketchy and would be insufficient in most cases.

i would suggest looking through some .htaccess mod_rewrite examples in the Apache Web Server [webmasterworld.com] forum and then ask more specific questions.
include a specific (other than using example.com) description of how it does or doesn't work for various types of non-canonical requests.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members