0

Ok, I am totally stuck. I've spent hours on this today, and I can't figure out what is going on.

This is my .htaccess file:

RewriteEngine On
RewriteRule ^articles/([0-9]+)/([a-zA-Z0-9\-]+)$ /article.php?id=$1 [L]
RewriteRule ^articles/([0-9]+)/([0-9]+)/([a-zA-Z0-9\-]+)$ /article.php?id=$1&page=$2 [L]

RewriteRule ^topics/([0-9]+)/([a-zA-Z0-9\-]+)$ /topic.php?id=$1 [L]
RewriteRule ^topics/(.+)$ /sub-topic.php?topic=$1 [L]

RewriteRule ^authors/([0-9]+)/([a-zA-Z0-9\-]+)$ /author.php?id=$1 [L]

RewriteRule ^preview/([0-9]+)/([a-zA-Z0-9\-]+)$ /preview.php?id=$1 [L]


ErrorDocument 400 /error?id=badrequest
ErrorDocument 401 /error?id=authreq
ErrorDocument 403 /error?id=forbidden
ErrorDocument 404 /error?id=notfound
ErrorDocument 500 /error?id=server

the part i am struggling with is the last rewrite rule, for "preview." It is a copy of the rewrite rule for "articles," but it will NOT pass the variable.

So, for instance:
www.domain.com/articles/4/the-title is passing the $id (4) to article.php with no problems.

www.domain.com/preview/4/the-title is NOT.

I know it is not a problem with the code on the page. Can anyone point me in the right direction?

FYI, this is on a Godaddy server that has always worked with no problems in the past.

THanks!

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by tustind
0
RewriteEngine On
RewriteRule ^/?articles/([0-9]+)/([a-zA-Z0-9\-]+)$ /article.php?id=$1 [L]
RewriteRule ^/?articles/([0-9]+)/([0-9]+)/([a-zA-Z0-9\-]+)$ /article.php?id=$1&page=$2 [L]

RewriteRule ^/?topics/([0-9]+)/([a-zA-Z0-9\-]+)$ /topic.php?id=$1 [L]
RewriteRule ^/?topics/(.+)$ /sub-topic.php?topic=$1 [L]

RewriteRule ^/?authors/([0-9]+)/([a-zA-Z0-9\-]+)$ /author.php?id=$1 [L]
RewriteRule ^/?authors/([0-9]+)/([0-9]+)/([a-zA-Z0-9\-]+)$ /author.php?id=$1&page=$2 [L]

RewriteRule ^/?preview/([0-9]+)/([a-zA-Z0-9\-]+)$ /preview.php?id=$1 [L]
RewriteRule ^/?preview/([0-9]+)/([0-9]+)/([a-zA-Z0-9\-]+)$ /preview.php?id=$1&page=$2 [L]

ErrorDocument 400 /error?id=badrequest
ErrorDocument 401 /error?id=authreq
ErrorDocument 403 /error?id=forbidden
ErrorDocument 404 /error?id=notfound
ErrorDocument 500 /error?id=server
0

Thanks for the reply... didn't change anything though... hmm.

0

In case anyone is interested... i figured it out. AND, I have no idea why this works.

I had to change

RewriteRule ^preview/([0-9]+)/([a-zA-Z0-9\-]+)$ /preview.php?id=$1 [L]

to

RewriteRule ^previews/([0-9]+)/([a-zA-Z0-9\-]+)$ /preview.php?id=$1 [L]

(note the change -- ^preview to ^previews)

Then I just changed my url paths. I honestly have no idea why this made a difference... but, it did.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.