Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Website URL redirection

Posted on 2016-10-06
10
Medium Priority
?
99 Views
Last Modified: 2016-10-12
I'm using IIS for a website but I have a redirection issue

If i enter the URL www.site.com/buyproducts it takes me to www.site.com/buyproducts however if I don't enter the www and just site.com/buyproducts it takes me to www.site.com.

Where would change the settings so that it will take me to www.site/com/buyproducts or site.com/buyproducts depending on which I enter?

Thanks
0
Comment
Question by:jdr0606
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 41832977
0
 
LVL 2

Expert Comment

by:Alex Smith
ID: 41832982
To redirect yourdomain.com to www.yourdomain.com, edit your web.config file and add the below segment under the <system.webserver> section. Ensure you modify the words “yourdomain.com” with your appropriate domain name.

<rewrite>
      <rules>
            <rule name="Redirect http://yourdomain.com to http://www.yourdomain.com HTTP" patternSyntax="ECMAScript" stopProcessing="true">
          <match url=".*"></match>
          <conditions>
            <add input="{HTTP_HOST}" pattern="^yourdomain.com$"></add>
            <add input="{HTTPS}" pattern="off"></add>
          </conditions>
          <action type="Redirect" url="http://www.yourdomain.com/{R:0}" redirectType="Permanent" appendQueryString="true"></action>
        </rule>
      </rules>
    </rewrite>

Open in new window

0
 

Author Comment

by:jdr0606
ID: 41832988
I'm not sure I was clear on my original email

What I want to happen is:

If I enter www.site.com/buyproducts I want it to go to www.site.com/buyproducts

but if I enter site.com/buyproducts I want it to go to site.com/buyproducts

Thanks
0
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 
LVL 2

Expert Comment

by:Alex Smith
ID: 41832992
As per Google or other search engine, you can use only one way of URL, It can be with www or without www.

If you using both Google can penalizes the website as duplicate content.

So first you must be finalize which domain you want to carry on.
0
 

Author Comment

by:jdr0606
ID: 41832993
Thanks for the info Alex

So let me look at it differently

If I enter www.site.com/buyproducts I want it to go to www.site.com/buyproducts

but if I enter site.com/buyproducts I want it to go to www.site.com/buyproducts
0
 
LVL 2

Expert Comment

by:Alex Smith
ID: 41832995
Perfect.

Now you can follow my first comment to resolve the issue.

Need any help feel free to contact.

Alex
0
 

Author Comment

by:jdr0606
ID: 41833011
Alex, as you can probably tell, i'm not very proficient with web.config or rewrite syntax.  I tried adding the code you suggested but it then generated a 500 error.  I likely need to replace rather than add to my existing rewrite but not sure where.

Here is what I have now under the rewrite section

        <rewrite>
            <rules>
                <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                    <match url="^morecatalogs$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="morecatalogs.aspx" />
                </rule>
                <rule name="morecatalogs with slash">
                    <match url="morecatalogs/" />
                    <action type="Rewrite" url="morecatalogs.aspx" />
                </rule>
            </rules>
        </rewrite>
0
 
LVL 2

Accepted Solution

by:
Alex Smith earned 2000 total points
ID: 41833048
Hi,

replace yourdomain.com with your actual domain name. and upload it.

or

share your domain or url which you want to redirect i can help you on redirect syntax.
0
 

Author Comment

by:jdr0606
ID: 41833620
This is what I entered, however when I enter kele.com/smartbuy it redirects to www.kele.com

Do I need to look at something in IIS as well?

       <rewrite>
            <rules>
                <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                    <match url="^morecatalogs$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="morecatalogs.aspx" />
                </rule>
                <rule name="morecatalogs with slash">
                    <match url="morecatalogs/" />
                    <action type="Rewrite" url="morecatalogs.aspx" />
                </rule>
<!-- Entered this URL 2016-10-06 -->
            <rule name="Redirect http://kele.com to http://www.kele.com HTTP" patternSyntax="ECMAScript" stopProcessing="true">
                <match url=".*"></match>
                <conditions>
                        <add input="{HTTP_HOST}" pattern="^yourdomain.com$"></add>
                        <add input="{HTTPS}" pattern="off"></add>
                </conditions>
          <action type="Redirect" url="http://www.kele.com/{R:0}" redirectType="Permanent" appendQueryString="true"></action>
              </rule>

            </rules>
        </rewrite>
0
 
LVL 2

Expert Comment

by:Alex Smith
ID: 41841382
Hi,

If you want to redirect the single page than you can also place the below given meta tag to your kele.com/smartbuy page header.

<meta http-equiv="refresh" content="01; ,URL=http://www.kele.com">

Please let me know have any issue.

Alex
0

Featured Post

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question