• I would like to create a redirect through my .htaccess file so that when people visit URL/employment it picks up the files from URL/wordpress/employment. Giving people the later link doesn’t look so good, but the main site is under construction so I don’t want to move the whole directory over and outside of the ‘wordpress’ folder. Is there a way to create this redirect? I tried the following in the .htaccess file in my main ROOT folder and it just gave me page errors:

    RewriteEngine On

    RewriteCond %{REQUEST_URI} !^/employment/.*$
    RewriteRule ^(.*)$ /employment/wordpress/ [L]

    When I tried to change the .htaccess in the /wordpress file it came up saying that access was denied. Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • C W (VYSO)

    (@cyril-washbrook)

    A simple .htaccess rewrite of the kind you are trying to do will leave the /wordpress subdirectory exposed: i.e. the end user may type in /employment, but they’ll still see /wordpress/employment when the page loads.

    If your aim is to keep WordPress in the /wordpress subdirectory but hide the subdirectory name from the end user, there’s an established way of doing so: see the tutorial on this page (under “Using a pre-existing subdirectory install”). You’ll need to read and follow the tutorial carefully.

    Thread Starter ivcatalina

    (@ivcatalina)

    Yes, this is what I am trying to do. I will read through that now, thank you!

    Thread Starter ivcatalina

    (@ivcatalina)

    This worked perfectly, however now the main URL shows the index.php from URL/wordpress that I was trying to keep hidden because i’m still working on it. Any chance I can create a rewrite rule to display another ‘landing page’ such as index.html (not .php)? The current holding page was index.html in the main root folder, but that now no longer shows.

    Thread Starter ivcatalina

    (@ivcatalina)

    UPDATE: I have managed to do so by adding this to the .htaccess file:

    # Provide Specific Index Page (Set the default handler)
    DirectoryIndex index.html index.php

    The only downside is I now can’t view the index.php site, but this will work for now, at least.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘.htaccess rewrite’ is closed to new replies.