Solved

RewriteEngine issue.

Posted on 2011-09-20
6
309 Views
Last Modified: 2012-08-14
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.html

But every time I test it I get a 404 page not found error.

Can anyone help?

Thanks!
0
Comment
Question by:ApOG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 13

Expert Comment

by:dsmile
ID: 36571703
Does http://www.domain.com/blog_read.php?id=[post number] give you normal page or 404?

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
0
 

Accepted Solution

by:
ApOG earned 0 total points
ID: 36571740
Nope, it does not work.

I also see other rewrite rules in the htaccess (that are working):

RewriteCond %{HTTP_HOST} ^domain.net [OR]

RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^/?$ "http\:\/\/www\.domain\.net" [R=301,L]

Thanks for your help dsmile!
0
 
LVL 13

Expert Comment

by:dsmile
ID: 36577954
If you have mod_rewrite works somewhere on your server, then try (2) in my first comment.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

Author Comment

by:ApOG
ID: 36577978
I'm sorry, how do I do that?
0
 
LVL 13

Expert Comment

by:dsmile
ID: 36578406
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
0
 

Author Closing Comment

by:ApOG
ID: 36597837
Thank you for all your help!
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question