Solved

Help with a .htaccess rewrite problem

Posted on 2006-10-20
2
184 Views
Last Modified: 2010-03-04
Hi

I'm a complete newbie when it comes to .htaccess - I know how to copy and paste into it but that's all!

What I'm after...is a rule that will automatically rewrite

www.domain.com/items/items/filename.php?stuff=3

to

www.domain.com/items/filename.php?stuff=3

Long live google constantly crawling dead files!

Thanks
0
Comment
Question by:su-n
[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
2 Comments
 
LVL 16

Accepted Solution

by:
HackneyCab earned 125 total points
ID: 17785591
Try this in the .htaccess file for the top-level directory:

RewriteEngine On
RewriteRule ^items/items/([a-z]+)\.php$ http://www.domain.com/items/$1.php [R=301]

That should cause requests for items/items to be redirected (causing the browser to change address) to the items/ folder. It will match any filename that consists of only alphabetic characters. If you want a more permissive pattern, it'll have to be adjusted to suit. The query string should be passed intact by the redirect, but let me know if this is not the case.
0
 
LVL 1

Author Comment

by:su-n
ID: 17787001
Thanks, Cabby - appreciated
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Suggested Courses

734 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