Solved

RewriteEngine issue.

Posted on 2011-09-20
6
300 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
  • 3
  • 3
6 Comments
 
LVL 13

Expert Comment

by:dsmile
Comment Utility
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
Comment Utility
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
Comment Utility
If you have mod_rewrite works somewhere on your server, then try (2) in my first comment.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:ApOG
Comment Utility
I'm sorry, how do I do that?
0
 
LVL 13

Expert Comment

by:dsmile
Comment Utility
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
Comment Utility
Thank you for all your help!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now