LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 10-24-2007, 06:33 AM   #1
SupremeUK
LQ Newbie
 
Registered: Oct 2007
Posts: 10

Rep: Reputation: 0
Question Apache RewriteEngine issue when typing URL


Hi all

When you visit this site: http://www.office-connection.com/advice/
you get straight through to the wordpress blog, which is great, no problem.

Now the issue is that if you manually type in the "/advice" you get redirected to http://www.office-connection.com/GUI/advice/ which then presents a 404 page from wordpress.
To stress this point:
Manually type in "/advice" in the URL after www.office-connection.com (minus the quotes of course

If you manually type in /advice/
then it works fine.

I have a layered structure, where all the frontend (website stuff), lives in the GUI directory.

I have 2 .htaccess files. One in the site directory as follows:

ErrorDocument 404 /GUI/404.htm

RewriteEngine on
Options +FollowSymLinks

RewriteCond %{HTTP_HOST} ^www.office-connection.com
RewriteCond $1 !^GUI/
RewriteRule ^(.*)$ /GUI/$1 [L]

RewriteCond %{HTTP_HOST} ^office-connection\.com$ [NC]
RewriteRule ^(.*)$ http://www.office-connection.com/$1 [R=301,L]


And another .htaccess file in the GUI/advice folder, as follows:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /advice/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /advice/index.php [L]
</IfModule>

# END WordPress


Any ideas on what why this is happening when the /advice is manually typed into the URL? Definately got me stumped that's for sure.

Any help / advice would be greatly appreciated.

Cheers

Last edited by SupremeUK; 10-24-2007 at 06:36 AM.
 
Old 10-26-2007, 05:11 AM   #2
SupremeUK
LQ Newbie
 
Registered: Oct 2007
Posts: 10

Original Poster
Rep: Reputation: 0
Thumbs up Solution found

Solution has been found, so I thought I'd post it up because it was a strange one.

Basically the 2 htaccess files were conflicting with each other, so this line was added into the root htaccess, before any of the other rules:
RewriteRule ^advice$ /advice/ [R=301,L]

Working great now - Thanks to Keith for the help
 
  


Reply

Tags
apache, rewriterule


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Apache URL issue - will redirect help... rlprofessional Linux - Newbie 9 06-16-2006 11:43 AM
apache and url help cambie Linux - Software 1 08-11-2005 08:49 AM
Apache RewriteEngine ApacheMan252 Linux - Software 10 09-04-2003 01:43 AM
RewriteEngine andy18 Linux - General 1 03-31-2003 12:59 PM
Apache Url simquest Linux - Software 2 11-26-2002 03:46 PM


All times are GMT -5. The time now is 05:17 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration