LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-09-2005, 04:39 PM   #1
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Rep: Reputation: 15
.htaccess mod_rewrite issue


I have a couple of subdirectories off my domain that are no longer valid, as they've been moved elsewhere, to the root directory or just deleted.

I was trying to put in a 301 redirect via .htaccess to point the non existant directories back to the root website, or another relevant directory. However when I keep going to the old URL, I still get the 403 error and it doesn't redirect anywhere.

For example lets take http://www.domain.com/gallery/ I've tried to put in a 301 redirect back to just http://www.domain.com using the following methods;

RewriteRule ^/gallery$ /
or
RewriteRule ^/gallery/$ /
or
Redirect /gallery http://www.domain.com/
or
Redirect permanent /olddirectory http://www.domain.com/

I'm running Apache 1.3.33 on Debian and I know mod_rewrite is installed because I use a rewrite for wgets to an google search.

What am I missing?
 
Old 12-10-2005, 05:26 AM   #2
Spudley
Member
 
Registered: Mar 2003
Location: Berkshire, England.
Distribution: SuSE 10.0
Posts: 299

Rep: Reputation: 32
Try this:

Code:
RewriteRule ^gallery/?(.*) /$1 [R=301,L]
I haven't had a chance to test that before posting, but hopefully it should do the trick. Let me know
 
Old 12-13-2005, 12:23 PM   #3
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Spudley
Try this:

Code:
RewriteRule ^gallery/?(.*) /$1 [R=301,L]
I haven't had a chance to test that before posting, but hopefully it should do the trick. Let me know

Nope, same result. If my wget rewrite didn't work I'd think mod_rewrite wasn't installed. This is driving me batty.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_rewrite questions? cadkins Linux - Software 0 03-25-2005 11:02 AM
Apache Mod_rewrite help! soulsniper Linux - Software 0 01-16-2005 05:23 PM
Suse 9.1 Pro & htaccess file: mod_rewrite not loading sorenson2743 SUSE / openSUSE 2 12-03-2004 11:36 PM
.htaccess .htpasswd issue Robin01 Linux - Newbie 4 12-24-2003 03:36 PM
Apache and mod_rewrite notsoevil Linux - General 0 01-23-2002 01:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration