Mobile app version of vmapp.org
Login or Join
Yeniel560

: 301 directory redirect exclude subdirectory I need to do a 301 directory redirect in my httpd.conf file but exclude a subdirectory within the directory. Example: RedirectPermanent /redirect/ http://www.mysite.com/.

@Yeniel560

Posted in: #301Redirect #Subdirectory

I need to do a 301 directory redirect in my httpd.conf file but exclude a subdirectory within the directory.

Example: RedirectPermanent /redirect/ www.mysite.com/.
But I want to exclude this subdirectory /redirect/example/.

Any ideas?

I tried this and it didn't work:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/redirect/example/?$ [NC]
RewriteRule ^/redirect/? mysite.com [R=301,L]

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Yeniel560

1 Comments

Sorted by latest first Latest Oldest Best

 

@Candy875

You should be able to do a RedirectPermanent for the parent directory then setup a sym link to the example directory in your web root dir.

Now test that this much actually works. If it does, create an Alias (http.conf) for the old directory to now point to the new directory link.

Assuming that RedirectPermanent is just looking for URLs which begin with specific text this should work. Unfortunately, I haven't tested any of this but presume that it'd work.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme