WordPress.org

Ready to get started?Download WordPress

Forums

redirect folder to homepage (4 posts)

  1. snowcrash
    Member
    Posted 7 years ago #

    Hello

    Maybe a simple thing to do in .htaccess but haven't been able to figure it out

    I would like to redirect any url with http://www.mysite.com/photos/... to just http://www.mysite.com/
    That is, anything in the photos folder & and its sub-folders & content gets redirected to the homepage

    How would I do this with .htaccess or is there an easier method?

    thanks

  2. Funkphenomenon
    Member
    Posted 7 years ago #

    Try RedirectMatch 301 /photos/(.*)$ http://mysite.com/

  3. snowcrash
    Member
    Posted 7 years ago #

    Hi

    thanks for the reply. Unfortunately it didn't work.

    This is how I added it in the .htaccess file:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /wp213/

    RedirectMatch /photos/(.*)$ http://localhost/wp213/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wp213/index.php [L]
    </IfModule>

    # END WordPress

  4. whooami
    Member
    Posted 7 years ago #

    localhost wont work.

    localhost is different for everyone -- its THEIR machine.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags