Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I spent hours in finding how to make my url pretty but no luck. I am hosted in DreamHost and using php under fcgi. I'm triying to make my:
http://www.wallpapers-football.net/wallpapers.php?id=705&cat=National%20Team%20Wallpapers
URL into pretty one :
http://www.wallpapers-football.net/705/National%20Team%20Wallpapers.html

Why is this not working:

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)\.html$ /wallpapers.php?id=$1&cat=$2 [L]

my htaccess:

#--- DH-PHP handlers ---
Options +FollowSymLinks +ExecCGI
AddHandler fastcgi-script fcg fcgi fpl
AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/dispatch.fcgi

Options All -Indexes

<files .htaccess>
order allow,deny
deny from all
</files>
ErrorDocument 404 /404-Page.php
share|improve this question

migrated from stackoverflow.com Jul 24 '13 at 4:15

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers 2

Try something like (untested): RewriteRule ^/([0-9]+)/(.*)\.html$ /wallpapers.php?id=$1&cat=$2 [L]

The first match should match any #'d category (and it would have to be a number), while the second grouping will match the remaining string.

share|improve this answer
add comment

Depending on your version (are you using Apache?) you may need to include the leading slash / at the beginning of your regular expression (after the start anchor) like this:

^/([^/]*)/([^/]*)\.html$

This worked for me. Otherwise, make sure you have the host name set correctly, look at your rewrite.log or other logs, and post if there are any errors.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.