Htaccess and mod_rewrite

wordpress

#1

I am trying to rewrite the general url http://www.digitalovertone.com/logue/00001/ to serve the page http://www.digitalovertone.com/logue/?postid=00001. The rewrite rule I am currently using is:
RewriteRule ^/logue/([0-9]+)/$ /logue/?postid=$1 [L]

This merely returns a 404 error when typing the first URL above. Can anyone point out where I am going wrong?

Many thank.


#2

In what directory do you have the .htaccess file? It should be in the parent directory of logue:
~/digitalovertone.com/.htaccess

And did you use the RewriteEngine on directive?

Well, that and you are using WordPress: have you not seen the option in
Options: Permalinks: Edit Permalink Structure? It will generate the mod_rewrite directives for you. And if you use this, then again it would have to be in the parent directory, unless you modify the RewriteBase directive.
eg: if you put the .htaccess file as
~/digitalovertone.com/logue/.htaccess
Then you would need

RewriteEngine On RewriteBase /logoue RewriteRule ^([0-9] )/$ /?postid=$1 [L]
but then again for
~/digitalovertone.com/.htaccess
Then you would need

RewriteEngine On RewriteBase / RewriteRule ^logue/([0-9] )/$ /logue/?postid=$1 [L] :cool: Perl / MySQL / HTML CSS


#3

Great - I will try this as soon as I get a chance! I am not actually using WordPress, just playing around with it on a subdomain, seeing what I can learn, etc. On the site I linked I am using my own CMS. Thank you!

Edit 1:
Intriguing effects. I tried two different .htaccess files, but neither had the impact I was looking for. I tested both on the URL http://www.digitalovertone.com/logue/00172/.

The first was placed in the “/” directory, and read:

RewriteEngine On
RewriteBase /
RewriteRule ^/logue/([0-9] )/$ /logue/?postid=$1 [L]

and returned a 404.

The second was placed in “/logue” and read:

RewriteEngine On
RewriteBase /logue
RewriteRule ^([0-9] )/$ /?postid=$1 [L]

and returned an unstyled version of the page accessed at http://www.digitalovertone.com/.

And now I am most confused.

Edit 2:
Third test:

RewriteEngine On
RewriteBase /logue
RewriteRule ^([0-9] )/$ ./?postid=$1 [L]

The addition of the “.” returns an unstyled version of the correct page. Any ideas how to get my CSS back?

Edit 3:
Absolute paths, apparently, for all things not PHP. Changed the path to my CSS from “…/styles/css.css” to “/styles/css.css” and we’re golden. Did the same to my images, and that worked. Did the same to my PHP includes and…that didn’t go over so well. I don’t know why. I also don’t know why I had to put it in the logue directory, but, really, at least it’s working now.