another .htaccess question

Posted on 2006-03-21
Last Modified: 2010-04-09
Can I redirect pages wqith .htaccess

I need when the page "mypage.html" is called for to direct it to "thepage.php"

I also need it to the same thing for these 2 pages

"onepage.html" needs to direct to "pages.php"

If so how can I write this.

Question by:smphil
    LVL 3

    Accepted Solution

    LVL 1

    Author Comment

    I still can't get it the rewrite working?
    LVL 3

    Expert Comment

    Ok, try the following in you httpd.conf:

    <IfModule alias_module>
        # Redirect: Allows you to tell clients about documents that used to
        # exist in your server's namespace, but do not anymore. The client
        # will make a new request for the document at its new location.
        # Example:
        # Redirect permanent /mypage.html
        Redirect permanent /onepage.html

    Remember to change yourdomain for your real domain... also make sure the directory matches
    LVL 1

    Assisted Solution

    why not just put this in the head of the HTML document:

    <meta http-equiv="refresh" content="0;URL=thepage.php" />
    LVL 20

    Assisted Solution

    by:Muhammad Wasif

    RewriteEngine On
    RewriteRule ^mypage\.html$ thepage.php [L]
    RewriteRule ^onepage\.html$ pages.php [L]

    But for this you need to enable mod_rewrite

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 Specialist

    HTML5 development skills are critical to all developers. HTML5 is the foundation to almost any development process. That's why business, design studios, development shops and other organizations need HTML5 developers. Get your foot in the door as a HTML5 specialist.

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
    In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
    In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now