Solved

htaccess rewrite 301 need help

Posted on 2012-03-27
6
327 Views
Last Modified: 2012-03-28
my old url is - http://www.mysite.com/search.php?search=tape

Then at /htaccess I - "Redirect 301 /search.php http://www.mysite.com/dictionary"

I then rewrite again in /dictionary - "RewriteRule ^word/(.*) dictionary/index.php?search=$1"

Result: http://www.mysite.com/dictionary/?search=tape

I am trying to get the URL as - "http://www.mysite.com/dictionary/word/tape"

Now the rewrite at the /dictionary does work, if I manually type in a URL like "http://www.mysite.com/dictionary/word/tape" it works. But from the redirects that come in it does not.

I hope this makes sense, because I have confused myself :)
0
Comment
Question by:cbielich
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Author Comment

by:cbielich
ID: 37772793
anyone?
0
 
LVL 15

Expert Comment

by:babuno5
ID: 37775155
my self also confused as to what you want to achieve

Can you post what is there in your .htaccess as is ?


And what i understand is you want the following url  

http://www.mysite.com/search.php?search=tape

to go to

http://www.mysite.com/dictionary/word/tape
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 37775170
I got the same impression as babuno5.  To implement that, try this:

RewriteCond %{QUERY_STRING} search=([a-zA-Z]+) [NC]
RewriteRule ^/?search.php$ /dictionary/word/%1 [R=301,NC]

Open in new window

0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 1

Author Comment

by:cbielich
ID: 37777243
Babuno5 - Yes that is exactly what I am trying to do

rountinet - my result URL is "http://www.mysite.com/dictionary/word/tape?search=tape"

close :)
0
 
LVL 51

Accepted Solution

by:
Steve Bink earned 500 total points
ID: 37778371
End the rule with a '?':

RewriteCond %{QUERY_STRING} search=([a-zA-Z]+) [NC]
RewriteRule ^/?search.php$ /dictionary/word/%1? [R=301,NC]

Open in new window

0
 
LVL 1

Author Closing Comment

by:cbielich
ID: 37778903
Thats it thanks :)
0

Featured Post

Don't Miss ATEN at InfoComm 2017!

Visit booth #2167 to see the  new ATEN VM3200 32 x 32 Modular Matrix Switch. Other highlights include the VE8950 4K HDMI Over IP Extender, VS1912 12-Port DP Video Wall Media Player  and VK2100 ATEN Control System. Register now with Free Pass Code ATEN288!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question