Solved

Help with a .htaccess rewrite problem

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Google Fonts cannot be displayed with Firefox and Internet Explorer 6 176
PHP temp path missing 4 48
maven set up 2 104
Apache Issues 9 49
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…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

24 Experts available now in Live!

Get 1:1 Help Now