Forum Moderators: phranque

Message Too Old, No Replies

Help Creating Htaccess File

         

griffithbanks

11:49 am on Nov 1, 2014 (gmt 0)

10+ Year Member



Hello,

Can someone help me create an htaccess file that will 301 redirect all folders to a corresponding script address that uses the folders name? And allows me to exclude certain folders?

For example:

http://www.example.com/dogs/

needs to redirect to

http://www.example.com/search.php?q=dogs

And then I need to exclude the following so they don't redirect.

http://www.example.com/blog/
http://www.example.com/dictionary/


Any help would be deeply appreciated.


-Griff

[edited by: Ocean10000 at 8:54 pm (utc) on Nov 1, 2014]
[edit reason] Examplified [/edit]

phranque

1:44 pm on Nov 3, 2014 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, griffithbanks!


what have you tried so far?

lucy24

4:51 pm on Nov 3, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



needs to redirect to

No. It doesn't. It needs to quietly rewrite to serve content from
search.php?q=captured-stuff-here
Why would you want to redirect from a shorter prettier URL to a longer uglier one?

It's the redirect-to-rewrite two-step. Search this forum and you'll find lots of posts describing the process. Among other things, there's a bit of boilerplate I paste in every few months.