Results 1 to 2 of 2
I need to direct all visitors that enter my /old top directory to be redirected to my home index page. This would include every single file in the old directory ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-09-2010 #1
- Join Date
- Apr 2010
Need wildcard mod_rewrite
I need to direct all visitors that enter my /old top directory to be redirected to my home index page. This would include every single file in the old directory that's either bookmarked or linked by Google. Simple 301 redirects work very well, however I have a mass amount of files in this directory and I don't want to redirect each file. What I really need is a wildcard redirect that will simply link all files in this one directory to automatically send visitor to homepage.
I have used cpanel for this initially, but I find that for a simple 301 redirect for one file the coding is too complex and ultimately doesn't work anyways. Even the wildcard setting does not work, so I have always felt comfortable doing my own mods and besides it's even better for SEO.
I have experimented with many different mods that should work but don't such as:
Redirect 301 /my_directory/ homepage URL
RedirectMatch 301 /my_directory(.*) /$1
RedirectMatch 301 ^/my_directory/(.*)$homepage URL/$1
Now keep in mind I do have an .htaccess file in this top directory and there was a suggestion in another forum to place this mod in this file while doing a standard 301 redirect in the root directory:
This does not work either.
RewriteRule ^my_directory/(.*)$ /$1 [R=301,NC,L]
There must be somebody in this community that has done this sucessfull wildcard redirect for a top directory.
- 04-14-2010 #2linux user # 503963