Page 1 of 1

mod_rewrite question

Posted: Tue Jan 23, 2007 10:55 pm
by intellivision
I'm getting 404's on http://www.appleswitcher.com/blog/

How to rewrite those requests to go to http://www.appleswitcher.com/ ?

And likewise http://www.appleswitcher.com/blog/feed/ to feed://http//www.appleswitcher.com/feed/ ?

Here's my .htaccess currently:

Code: Select all

RewriteEngine On
# BEGIN stats passthru
RewriteBase /
RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/failed_auth.html$
RewriteRule ^.*$ - [L]
# END stats passthru

<IfModule mod_rewrite.c>
RewriteEngine On

# BEGIN product_reviews
RewriteBase /
RewriteCond product_reviews/%{QUERY_STRING} submission=true
RewriteRule product_reviews/mode/([0-9]+)/id/([0-9]+)(/)?$ product_reviews.php?mode=$1&id=$2&flag=2 [L]
RewriteRule product_reviews/mode/([0-9]+)/id/([0-9]+)(/)?$ product_reviews.php?mode=$1&id=$2&flag=1 [L]
# END product_reviews

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

# END WordPress
I tried to do something like

Code: Select all

# BEGIN /blog/ fix attempt
RewriteRule /^blog/$  /index.php [L]
to no avail. I suck at mod_rewrite.[/quote]

Posted: Tue Jan 23, 2007 11:17 pm
by Kieran Huggins
try:

Code: Select all

RewriteRule ^blog/(.*)$  $1 [L]
(I'm no expert)

Posted: Wed Jan 24, 2007 5:13 am
by dude81
This should be a good tutorial for everybody who donno rewrite rules I guess :wink:
http://www.sitepoint.com/article/guide ... writing/2

Posted: Wed Jan 24, 2007 5:57 pm
by intellivision
Thanks KH and dude81 for your help.

K, your's doesn't work.

Dude, I read that tutorial and even another but I still can't get it to work.

I tried the very simple

Code: Select all

RewriteBase /
RewriteRule ^blog/  / [L]
and the more complex

Code: Select all

RewriteBase /
RewriteCond %{REQUEST_URI} ^blog/(.*)$
RewriteRule /$ - [L]
But those still don't rewrite http://www.appleswitcher.com/blog/

Do I need to make an exception to the rules that are already there, instead of another rule?

I'm just not getting anywhere. Could you point me in the right direction?

Thanks,
Confused

Posted: Wed Jan 24, 2007 10:16 pm
by dude81
What is the blog software you are using, if it is wordpress :!: , then you need not do anything on rewrite rules.

Posted: Thu Jan 25, 2007 2:47 pm
by intellivision
Yes, WordPress.

My install directory is /blog, but the application writes its own mod_rewrite rules (above, between the "#wordpress" comments) to appear at the root. I configured it this way through the admin panel so as not to clutter the root level with WP files.

So the current rules are working. Except for requests for files in appleswitcher.com/blog, which trigger a 404. It's weird.

That's why I don't know if
a) it should work as is, and something else is messed up or
b) I should add a rule or
c) I should modify an existing rule


thx for the help here.

Posted: Mon Jan 29, 2007 12:14 am
by dude81
I Hope Im not too late,

But still not through with your question properly, sorry for my english,
You mean to say
appleswitcher.com should point to your blog and
appleswitcher.com/blog/ also should point to blog.

If that is the case, I think you need to add a rewrite rule in classes wp_rewrite.