Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

htaccess rewrite 301 need help

Posted on 2012-03-27
6
Medium Priority
?
339 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

618 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