Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Closed Thread
 
Thread Tools Display Modes
Share |
  #1  
Old 07-10-2015, 11:21 AM
RedScooter's Avatar
RedScooter RedScooter is offline
v7n Mentor
 
Join Date: 12-19-08
Location: Texas
Posts: 248
iTrader: 0 / 0%
.htaccess folder matching

I can't seem to wrap my head around wildcards. I have old URLs like this:

http://mysite.com/folderone/foldertwo/anyfoldername
http://mysite.com/folderone/foldertwo/anyfoldername?querystringstuff
http://mysite.com/folderone/foldertwo/anyfoldername/anotherfoldername

What I want to do is redirect anything with "/folderone/foldertwo/" and something following it to another page. So if I had a URL

http://mysite.com/folderone/foldertwo/

it would NOT be redirected, because it contains no folders or files after "foldertwo," but URLs like

http://mysite.com/folderone/foldertwo/anyfoldername
http://mysite.com/folderone/foldertwo/afilename
http://mysite.com/folderone/foldertwo/lots/of/folders

would all be redirected to a single page.

I have tried:

Code:
RedirectMatch 301 /folderone/foldertwo/(.*)/(.*)
but it's not working. Any suggestions or references anyone can offer? I haven't found a good .htaccess tutorial that is comprehensive enough to understand it, and I'd really like to learn how to figure it out myself.
 

Advertisement

Advertisement

  #2  
Old 07-10-2015, 12:49 PM
RedScooter's Avatar
RedScooter RedScooter is offline
v7n Mentor
 
Join Date: 12-19-08
Location: Texas
Posts: 248
iTrader: 0 / 0%
For what help it may be to others, I finally solved it myself:

HTML Code:
RedirectMatch 301 /folderone/foldertwo/[a-z](.*)/[a-z](.*) http://mysite.com/destination
 
Go Back   Webmaster Forum > Web Development > Coding Forum

Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conflict, What is the right htaccess rule, default homepage file with htaccess? basketmen Coding Forum 2 01-20-2009 08:50 AM
.htAccess syntax to limit folder access? Mr CHill Web Design Lobby 3 12-10-2008 03:03 PM
.htaccess redirect folder to other folder theChronic Coding Forum 3 06-28-2008 02:42 PM
not matching with forum but need help simplytothe Web Design Lobby 0 09-11-2006 07:48 AM
Need help with folder/.htaccess deny all Kalina Web Design Lobby 11 01-25-2006 06:57 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 01:55 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC