Forum Moderators: phranque
index.php?v=$1&s=$2&p=$3&c=$4 I know this one would do
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/page([^/\.]+)/([A-Za-z0-9-]+)/?.html$ index.php?v=$1&s=$2&p=$3&c=$4 [L]
(www.example.com/view/show/page1/category.html) But by problem is the variables v, s, p and c are NOT REQUIRED to be always present. So using the mod rewite above will treat the following
www.example.com/show as www.example.com/index.php?v=$1 while it should be www.example.com/index.php?s=$1 OR
www.example.com/page1/category.html as www.example.com/index.php?v=$1&s=$2 while it should be www.example.com/index.php?p=$1&c=$2 How can I resolve this? Thanks
What do "view" and "show" actually do? Are they static words? Are they redundant information? Beware that you must not have multiple URLs that map to the same content page, as that will cause many problems.
The URL request
www.example.com/page1/category.html does not match your existing rule, because your rule requires there to be two elements, each of one character or more, and that are separated by slashes, before the word "page". If the code had used
([A-Za-z0-9-][b]*[/b]) you would have the problem you describe, but luckily it uses ([A-Za-z0-9-][b]+[/b]) instead. Some other questions:
Wouldn't it be usual to have the page number as the last item in the URL?
What page of content is returned if the page number is missing? Is it page one? If it is, then that is a Duplicate Content issue - two different URLs that both return the same content.
What URL is shown in the browser for page one when you go from the index to page one? What is the URL shown in the browser when you are on page one, having just gone from page two to page one? Are they different, even by one character? If so, that is another Duplicate Content issue.
Does the same content return at both non-www and at www URLs, or does one of them issue a 301 redirect?
[edited by: g1smd at 9:33 am (utc) on Oct. 13, 2008]
www.example.com/view-nameofgroup/
RewriteRule ^view-([A-Za-z0-9-]+)/$ index.php?s=$1 [L]
www.example.com/view-nameofgroup/show-showname/
RewriteRule ^view-([A-Za-z0-9-]+)/show-([A-Za-z0-9-]+)$ index.php?v=$1&s=$2 [L]
where you add short words and a dash in front of some options and use modrewrite rules to distinguish what variables mean what using those words, thats how i was thinking of doing it for my site, but you would need alot of rules i guess...
Im not sure if there is any other way, maybe someway to search the uri for "show-" and fetch everything after that until a /, and then search the uri for "view-" until a slash, and then take the variables do a rewrite.. im not sure how/if that can be done though...
[webmasterworld.com...]
I am working on something right now that has more than 40 rules, each for a specific format.