Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts

    Redirect in htaccess

    Hello I have deleted /page-one/ would like to redirect:

    http://mysite.com/page-one/

    To:

    http://mysite.com


    with or without ending slash /

    How to write that rule?
    Thank you

  • #2
    New Coder
    Join Date
    Sep 2011
    Location
    Omaha, NE
    Posts
    49
    Thanks
    1
    Thanked 6 Times in 5 Posts
    redirect /page-one/ http://mysite.com
    redirect /page-one http://mysite.com

    You may want to do both, since the first is a folder directory, the second is an actual page.

    Hope that helps.
    Web Design Omaha Ne
    Hold yourself responsible for a higher standard than anybody expects of you. Never excuse yourself.
    - Henry Ward Beecher

  • #3
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts
    are you sure this is a good code what you gave?
    I need to use a RewriteRule and a 301

  • #4
    Regular Coder Microsuck's Avatar
    Join Date
    Oct 2011
    Location
    127.0.0.1
    Posts
    123
    Thanks
    44
    Thanked 5 Times in 5 Posts
    Well first, /page-one needs to exist.

    Then, inside /page-one, you put your htaccess file.

    Put this in htaccess:

    Code:
    redirect 301 /page-one/ http://www.mysite.com/
    RewriteRule is if you are setting a rule, meaning the action placed inside of htaccess will be used for more than just /page-one/.

  • #5
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts
    page one is a virtual page that now exists, but it will be deleted. It is not a folder. It is a wordpress page...

    So I cannot put the .htaccess on /page-one
    I can edit only the htaccess on the root home page

  • #6
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_URI} /page-one
    RewriteRule (.*) http://mysite.com/ [R=301,L]

  • Users who have thanked Inigoesdr for this post:

    utnalove (10-30-2011)

  • #7
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts
    Hi Inigoesdr, it works fine except for a little detail.
    If I have other pages that are named for example:

    page-one-of-ten
    or
    page-oneeeesssss

    They are also redirected.
    I would like to redirect only:
    page-one
    and
    page-one/
    and
    page-one/whatever

  • #8
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/page-one [OR]
    RewriteCond %{REQUEST_URI} ^/page-one/
    RewriteRule (.*) http://mysite.com/ [R=301,L]

  • Users who have thanked Inigoesdr for this post:

    utnalove (10-30-2011)

  • #9
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts
    Hi, it is still redirecting the same as before. I will give you the right URL:

    These have to be redirected:
    http://glamourina.pl/jestem-na
    http://glamourina.pl/jestem-na/

    to
    http://glamourina.pl

    however these pages should not be redirected:
    http://glamourina.pl/jestem-najlepsza
    http://glamourina.pl/jestem-na/anotherpage

    With the actual code everything everything is being redirected:
    Code:
    RewriteCond %{REQUEST_URI} ^/jestem-na [OR]
    RewriteCond %{REQUEST_URI} ^/jestem-na/
    RewriteRule (.*) http://glamourina.pl/ [R=301,L]

  • #10
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts
    What do you suggest?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •