ApOG
asked on
RewriteEngine issue.
I am trying to use the rewrite engine to create seo urls for our blog (custom made).
To read a post, the url looks like this:
http://www.domain.com/blog_read.php?id=[post number]
So I added the following to my .htaccess:
RewriteEngine On
RewriteRule ^blog/([0-9]+)/(.*?).html$ /blog_read.php?id=$1
So the final url looks like this: www.domain.com/blog/[post number]/the-post-title.htm l
But every time I test it I get a 404 page not found error.
Can anyone help?
Thanks!
To read a post, the url looks like this:
http://www.domain.com/blog_read.php?id=[post number]
So I added the following to my .htaccess:
RewriteEngine On
RewriteRule ^blog/([0-9]+)/(.*?).html$
So the final url looks like this: www.domain.com/blog/[post number]/the-post-title.htm
But every time I test it I get a 404 page not found error.
Can anyone help?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you have mod_rewrite works somewhere on your server, then try (2) in my first comment.
ASKER
I'm sorry, how do I do that?
Edit this setting in httpd.conf of Apache on your server.
You can read more here http://httpd.apache.org/docs/2.0/mod/core.html
You can read more here http://httpd.apache.org/docs/2.0/mod/core.html
ASKER
Thank you for all your help!
If you can access that url normally, then try this simple code
RewriteEngine On
RewriteRule ^blog/1.html$ /blog_read.php?id=1
And check whether http://www.domain.com/blog/1.html gives you http://www.domain.com/blog_read.php?id=1
If not, then may be
1. your apache server doesn't support mod_rewrite --> enable it first, or
2. your apache config doesn't allow override of apache default config using .htaccess --> change AllowOverride of your <Directory> from None to All