Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old May 4th, 2008, 07:01 PM
hawthorn hawthorn is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 2 hawthorn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 16 sec
Reputation Power: 0
mod_rewrite - Wordpress mod_rewrite problem

I am completely new to mod_rewrite.

My problem is this.

I have a Wordpress blog mydomain1.com installed in root (www) .

I have a second domain , mydomain2.com in www/mydomain2.com/

Wordpress adds the following to .htaccess in root...

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

# END WordPress

ErrorDocument 404 /index.php?error=404

The problem is that any invalid URL for mydomain2.com .

e.g. mydomain2.com/rubbish.php gets re-directed to
mydomain2.com/index.php

instead of giving a 404.

How can I stop this please?

Reply With Quote
  #2  
Old May 5th, 2008, 05:09 AM
atlantisstorm atlantisstorm is offline
Hang your freedom higher.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2005
Posts: 600 atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 10 h 14 m 2 sec
Reputation Power: 113
I'm not a complete expert on this, but you seem to have a contradiction in your rewrite rules. This...

Code:
...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
...


... appears to be telling apache to send any request that doesn't resolve to a file (-f) or directory(-d) to your home page (index.php). This, in effect, will catch the 404 error your trying to handle so your ErrorDocument reference would appear to be redundant in this instance.
__________________
"Badges? We ain't got no badges. We don't need to badges! I don't have to show you any stinkin' badges!!"

Reply With Quote
  #3  
Old May 5th, 2008, 06:34 AM
hawthorn hawthorn is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 2 hawthorn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 16 sec
Reputation Power: 0
.er.. yes I have realised the 404 of my ways...

Quote:
Originally Posted by atlantisstorm
I'm not a complete expert on this, but you seem to have a contradiction in your rewrite rules. This...

Code:
...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
...


... appears to be telling apache to send any request that doesn't resolve to a file (-f) or directory(-d) to your home page (index.php). This, in effect, will catch the 404 error your trying to handle so your ErrorDocument reference would appear to be redundant in this instance.



..I was so obssessed about the RewriteConds I missed the bloody obvious ;-))

Reply With Quote
  #4  
Old May 5th, 2008, 02:35 PM
rockurchin rockurchin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Location: Los Angeles
Posts: 43 rockurchin User rank is Lance Corporal (50 - 100 Reputation Level)rockurchin User rank is Lance Corporal (50 - 100 Reputation Level)rockurchin User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 14 h 49 m 55 sec
Reputation Power: 1
That's the point of the mod rewrite though. If you change this friendly urls won't work at all because none of them physically exist.

If you want to actually have to have a page not found in your wordpress instead of showing the index you need to make sure your theme includes a 404.php file. This should help:

http://codex.wordpress.org/Creating_an_Error_404_Page

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > mod_rewrite - Wordpress mod_rewrite problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway