Solved

Help with a .htaccess rewrite problem

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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

Suggested Solutions

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). #…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 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