Solved

Help with a .htaccess rewrite problem

Posted on 2006-10-20
2
181 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
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Suggested Solutions

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 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). #…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

947 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now