Topic: global rewrite to subfolder(s)
|

|
| Author |
|
dhtaccess Newbie

Joined: 01 April 2011 Location: United States
Online Status: Offline Posts: 5
|
| Posted: 01 April 2011 at 1:31pm | IP Logged
|
|
|
Hi People,
I'm looking to create a rule where dead links pointing to a missing file in a subfolder will redirect to just that subfolder in question thereby hitting either the "default.php" or "index.php" file.
The problem with this particular site is the usage of "index.php" in many subfolders so the other rule for "index.php" sends some of these links to the root domain. This is better than a dead link but not optimal for conversion. Any help would be appreciated.
# Helicon ISAPI_Rewrite configuration file # Version 3.1.0.78
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 04 April 2011 at 2:29am | IP Logged
|
|
|
So, you have ISAPI_Rewrite 3?
Then please try the following lines:
RewtiteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^folder/subfolder/[^.]+\.[^.]+$
folder/subfolder/ [NC.R=301,L]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
dhtaccess Newbie

Joined: 01 April 2011 Location: United States
Online Status: Offline Posts: 5
|
| Posted: 06 April 2011 at 12:13pm | IP Logged
|
|
|
Thanks for the response Anton. I will give it a try and let you know how I make out.
|
| Back to Top |
|
| |
dhtaccess Newbie

Joined: 01 April 2011 Location: United States
Online Status: Offline Posts: 5
|
| Posted: 28 April 2011 at 3:13pm | IP Logged
|
|
|
Hi Anton,
Your suggestion worked like a charm but now I have one more (which should be easier but for some reason its not working).
I have several instances where inbound links have sub-directories in them that were either deleted or never existed in the target sites folder structure. e.g. /subdirectory1/subdirectory2/subdirectory3/file.php. Subdirectory3 doesn't exist so I thought the following would fix the problem but it doesn't;
Rewriterule /subdirectory1/subdirectory2/subdirectory3/file.php http://www.domain.com/subdirectory1/subdirectory2/file.php [I,O,RP,L]
Any help would be appreciated. BTW I want this to be a permanent redirect so would the trailing conditions be "[R=301,L]"?
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 29 April 2011 at 3:32am | IP Logged
|
|
|
Please try to fix your rule like this:
RewriteRule ^subdirectory1/subdirectory2/subdirectory3/file\.php$ http://www.domain.com/subdirectory1/subdirectory2/file.php [NC,R=301,L]
Yes, the correct syntax for permanent redirect in ISAPI_Rewrite 3 is R=301.
__________________ Regards,
Anton
|
| Back to Top |
|
| |
|
|
If you wish to post a reply to this topic you must first login
If you are not already registered you must first register
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum
|