|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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? |
|
#2
|
|||
|
|||
|
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!!" |
|
#3
|
|||
|
|||
|
.er.. yes I have realised the 404 of my ways...
Quote:
..I was so obssessed about the RewriteConds I missed the bloody obvious ;-)) |
|
#4
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > mod_rewrite - Wordpress mod_rewrite problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|