开发者

htaccess redirect conflict issue

I'm having an issue with conflicting quert strings on a page. for instance the page can look like the following:

website.com/photos/type/album-name/page-2/ AND website.com/photos/type/album-name/photo-id/

the issue here is that I don't know how to make it so that it knows that when it says 'page-2' that it takes one rule, and when it's the photo-id it takes another.

I have the following

RewriteRule ^photos/([\w+.-]+)/([\w+.-]+)/([\w+.-]+)/?$ /photos.php?view=$1&slug=$2&page=$3 [QSA,L]开发者_JS百科
RewriteRule ^photos/([\w+.-]+)/([\w+.-]+)/([0-9]+)/?$ /photos.php?view=$1&slug=$2&pid=$3 [QSA,L]


Instead of having different rewrite rules for every possible query string, why don't you have a generalized rewrite and handle the query strings in your application?

Or, for your second query, try this:

RewriteRule ^photos/([\w+.-]+)/([\w+.-]+)/(page\-[0-9]+)/?$ /photos.php?view=$1&slug=$2&pid=$3 [QSA,L]

Your URLs would look like,

website.com/photos/type/album-name/page-2/ --> with the 'page-' keyword.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜