on my local computer (also server) my htaccess code works, but when computer makes me web.config rules...
they dont work. =(
Because the web.config is not the htaccess file.
A 301 redirect in the web.config will only work if the web.config file is accessed. If an ASP.NET page is not requested, then the web.config may not be used.
Why not stick with PHP and a Linux server and use htaccess?
ilma55
0 Points
9 Posts
301 redirect in web.config
Apr 22, 2010 09:18 PM|LINK
Hello!
I need help!
web.config is too hard for me.
please, help! I need 301 redirect and I don't know how to write it.
I need redirect from site.com/index.php to www.site.com/
I found one example but I am not sure that is right
<rule name="Redirect to root" patternSyntax="Wildcard" stopProcessing="true">
<match url="index.php" />
<action type="Redirect" url="/" appendQueryString="false" redirectType="Permanent" />
</rule>
Das.Sandeep
Star
10652 Points
1897 Posts
Re: 301 redirect in web.config
Apr 23, 2010 01:16 AM|LINK
http://www.aspcode.net/ASPNET-301-redirect.aspx
Important info:http://forums.asp.net/t/1130676.aspx
Please give us feedback no matter whether you get your answer.
Please "Mark as Answer" if it's useful for you.
Regards,
Sandeep
ilma55
0 Points
9 Posts
Re: 301 redirect in web.config
Apr 23, 2010 08:11 AM|LINK
Hello!
thank you!
but it's not help me!
Im not asp.net programmer.
Im php programmer. I found a lot of information about 301 redirect in htaccess
but about web.config... nothing!
I found one example and it works but I not sure that is right!!!
I know, I can do 301 redirect in admin control pane, but Im not admin
sathish_juk
Participant
1777 Points
361 Posts
Re: 301 redirect in web.config
Apr 23, 2010 09:14 AM|LINK
By default in php if looking for site.com it search for site.com/index.php
In Asp.net
if looking for site.com it search for site.com/default.aspx
Sathish Kumar
Mark this post as "ANSWER", if it helped you..
ilma55
0 Points
9 Posts
Re: 301 redirect in web.config
Apr 23, 2010 09:19 AM|LINK
I need redirection to root
XiaoCheng Fa...
All-Star
17743 Points
1414 Posts
Re: 301 redirect in web.config
Apr 26, 2010 11:12 AM|LINK
Hi,
You can set redirects in IIS:
To redirect requests to another Web site or directory
1.
In IIS Manager, expand the local computer, right-click the Web site or directory you want to redirect, and click Properties.
2.
Click the Home Directory, Virtual Directory, or Directory tab.
3.
Under The content for this source should come from, click A redirection to a URL.
4.
In the Redirect to box, type the URL of the destination directory or Web site.
Or you can remap the .php file to a .aspx page contain follows:
<% Response.Redirect("/"); %>
I'm looking forward for your test result.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
ilma55
0 Points
9 Posts
Re: 301 redirect in web.config
Apr 26, 2010 11:31 AM|LINK
Hi!
I have no access to IIS Manager!
I am not server admin!
so that is why I need right code that I can use in web.config
I have one but I think its wrong... =((
XiaoCheng Fa...
All-Star
17743 Points
1414 Posts
Re: 301 redirect in web.config
Apr 29, 2010 11:07 AM|LINK
Hi,
You can try urlmapping:
Or you can try UrlRewrite by UrlRewrite module:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <configSections> <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" /> </configSections> <system.web> <httpModules> <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" /> </httpModules> </system.web> <system.webServer> <modules runAllManagedModulesForAllRequests="true"> <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" /> </modules> <validation validateIntegratedModeConfiguration="false" /> </system.webServer> <rewriter> <rewrite url="~/products/(.+)" to="~/products.aspx?category=$1" /> </rewriter> </configuration>For more about UrlRewrite:
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
I'm looking forward for your reply.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
ilma55
0 Points
9 Posts
Re: 301 redirect in web.config
Apr 29, 2010 11:35 AM|LINK
Thanks. I will try!
but, look! I use my htaccess code and put it into some form that rebuilt my htaccess code to web.config code.
on my local computer (also server) my htaccess code works, but when computer makes me web.config rules...
they dont work. =(
Why???
______________________________
Look: My IIS version is 7.0
asp version is 3.5
jeff@zina.co...
All-Star
87677 Points
11637 Posts
Moderator
Re: 301 redirect in web.config
Apr 29, 2010 03:00 PM|LINK
Because the web.config is not the htaccess file.
A 301 redirect in the web.config will only work if the web.config file is accessed. If an ASP.NET page is not requested, then the web.config may not be used.
Why not stick with PHP and a Linux server and use htaccess?
Jeff