StolaWatgag
New Member
Summery: 301 Redirection Help: I have modified both web.config and htaccess but no Redirect
Dear Friends, I am facing the most bizarre of the problems and any help is much appreciated.
INFO:
my domain is grasshoppernetwork.com and i want to permanently redirect it to www.grasshoppernetwork.com
My server is hosted in shared hosting in windows II7 Server. I am hosting a MyBB forum in the base domain.
Here is my Web.config file snippet
PHP Code: \[code\]<rule name="Redirect domain.com to www" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^grasshoppernetwork.com$" />
</conditions>
<action type="Redirect" url="http://www.grasshoppernetwork.com/{R:0}" redirectType="Permanent"/>
</rule>
\[/code\] I have put that in wwwroot and also the hosting folder. But it does show 200 response code for
grasshoppernetwork.com returns a 200 (OK) response.
www. grasshoppernetwork. com returns a 200 (OK) response.
grasshoppernetwork.com/index.php returns a 200 (OK) response.
www. grasshoppernetwork.com/index.php returns a 200 (OK) response.
So I also Modified My htaccess. Here is the snippet
PHP Code: \[code\]RewriteEngine on
RewriteRule ^forum-([0-9]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]
RewriteRule ^forum-([0-9]+)-page-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 [L,QSA]
RewriteCond %{HTTP_HOST} ^grasshoppernetwork.com
RewriteRule (.*) http://www.grasshoppernetwork.com/$1 [R=301,L]
\[/code\] Still the same problem. Have I gone wrong somewhere? Can somebody please help me? Hi, Best solution for redirect try in Apache server itself.
Quote: Originally Posted by Rupam Das http://www.v7n.com/forums/seo-forum/282921-please-help-301-redirect.html#post1783985 I believe the config code you wrote relies on the URL Rewrite Module or the Url Routing Module and maybe even the Url Routing Handler.
Basically, I think you might need to get some modules enabled. The article @ponmayil mentioned also referred to that fact. If your not self hosted try asking them to enable/install the URL Rewrite Module and see what response you get!
I also think you may have to do some ISAPI stuff if you want it to redirect non .net type files. So test it with a few file types after you get it working, like images.
Sorry I'm vague, its a long time since I did redirects in the config file. I've written my own Handlers to do it now
Finally, .htaccess files will not work on IIS. There is an app you can install to get close to the .htaccess functionality but it's mute now Microsoft supports their own redirect/rewriting system. Quote: Originally Posted by ponmayil http://www.v7n.com/forums/seo-forum/282921-please-help-301-redirect.html#post1784098 Hi, As par my knowledge web.config would do the role. So I made the changes in web.config. Another subdomain of mine got redirected with that all right.
But The code that I used in we.config was not doing anything. So I thought, may be just may be it might be a problem with MyBB! So I tried with .htaccess also.
I know that in IIS, web.config would do the trick. but
is not getting that Redirect. My Hosting provider is quite cooperative and they tried their bit. But even they are clueless.
It is not that I am an amature in programming or this is my first redirect code. But am I missing something? Really this issue is hammering my head.
Dear Friends, I am facing the most bizarre of the problems and any help is much appreciated.
INFO:
my domain is grasshoppernetwork.com and i want to permanently redirect it to www.grasshoppernetwork.com
My server is hosted in shared hosting in windows II7 Server. I am hosting a MyBB forum in the base domain.
Here is my Web.config file snippet
PHP Code: \[code\]<rule name="Redirect domain.com to www" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^grasshoppernetwork.com$" />
</conditions>
<action type="Redirect" url="http://www.grasshoppernetwork.com/{R:0}" redirectType="Permanent"/>
</rule>
\[/code\] I have put that in wwwroot and also the hosting folder. But it does show 200 response code for
grasshoppernetwork.com returns a 200 (OK) response.
www. grasshoppernetwork. com returns a 200 (OK) response.
grasshoppernetwork.com/index.php returns a 200 (OK) response.
www. grasshoppernetwork.com/index.php returns a 200 (OK) response.
So I also Modified My htaccess. Here is the snippet
PHP Code: \[code\]RewriteEngine on
RewriteRule ^forum-([0-9]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]
RewriteRule ^forum-([0-9]+)-page-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 [L,QSA]
RewriteCond %{HTTP_HOST} ^grasshoppernetwork.com
RewriteRule (.*) http://www.grasshoppernetwork.com/$1 [R=301,L]
\[/code\] Still the same problem. Have I gone wrong somewhere? Can somebody please help me? Hi, Best solution for redirect try in Apache server itself.
Quote: Originally Posted by Rupam Das http://www.v7n.com/forums/seo-forum/282921-please-help-301-redirect.html#post1783985 I believe the config code you wrote relies on the URL Rewrite Module or the Url Routing Module and maybe even the Url Routing Handler.
Basically, I think you might need to get some modules enabled. The article @ponmayil mentioned also referred to that fact. If your not self hosted try asking them to enable/install the URL Rewrite Module and see what response you get!
I also think you may have to do some ISAPI stuff if you want it to redirect non .net type files. So test it with a few file types after you get it working, like images.
Sorry I'm vague, its a long time since I did redirects in the config file. I've written my own Handlers to do it now
Finally, .htaccess files will not work on IIS. There is an app you can install to get close to the .htaccess functionality but it's mute now Microsoft supports their own redirect/rewriting system. Quote: Originally Posted by ponmayil http://www.v7n.com/forums/seo-forum/282921-please-help-301-redirect.html#post1784098 Hi, As par my knowledge web.config would do the role. So I made the changes in web.config. Another subdomain of mine got redirected with that all right.
But The code that I used in we.config was not doing anything. So I thought, may be just may be it might be a problem with MyBB! So I tried with .htaccess also.
I know that in IIS, web.config would do the trick. but
PHP:
<conditions>
<add input="{HTTP_HOST}" pattern="^grasshoppernetwork.com$" />
</conditions>
<action type="Redirect" url="http://www.grasshoppernetwork.com/{R:0}" redirectType="Permanent"/>
It is not that I am an amature in programming or this is my first redirect code. But am I missing something? Really this issue is hammering my head.