Forum Moderators: phranque
domain.com/?typ=#*$!
domain.com/#*$!.html
domain.com/?typ=#*$!&cat=YYY
domain.com/#*$!-YYY.html
domain.com/?typ=#*$!&cat=YYY&sct=ZZZ
domain.com/#*$!-YYY-ZZZ.html
First URL is the dynamic format, latter is desired URL.
Can do it by adding extra bits to the URLs, like
domain.com/?typ=#*$!
domain.com/#*$!.html
domain.com/?typ=#*$!&cat=YYY
domain.com/00-#*$!-YYY.html
domain.com/?typ=#*$!&cat=YYY&sct=ZZZ
domain.com/11-#*$!-YYY-ZZZ.html
But, not otherwise.
This is the .htaccess file contents so far-
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^index.html$ default.php
RewriteRule ^(.*)-(.*)-(.*).html?typ=$1&cat=$2&sct=$3 [QSA,L]
RewriteRule ^(.*)-(.*).html?typ=$1&cat=$2 [QSA,L]
RewriteRule ^(.*).html?typ=$1 [QSA,L]
Can only get the first rule to work (no matter what order I put them in).
BTW the space has been removed (by the forum software) between html and the question mark in the above code.
Thanks
David
Jim
Got these dynamic URLs-
domain.com/?typ=KEYWORD
domain.com/?typ=KEYWORD&cat=KEYWORD2
Want these static URLs-
domain.com/KEYWORD.html
domain.com/KEYWORD-KEYWORD2.html
There are more similar versions.
Have edited the script so the URLs look like the above (in a browser), but I can't get more than one type of the static URL to work because of how the rules work together. So I can get KEYWORD.html or KEYWORD-KEYWORD2.html to work but not both at the same time.
Does that make sense?
I've rewrote the original question a bit to get past the forum software changing the URL.
Is it possible to rewrite these URLs-
domain.com/?typ=VVV
domain.com/VVV.html
domain.com/?typ=VVV&cat=YYY
domain.com/VVV-YYY.html
domain.com/?typ=VVV&cat=YYY&sct=ZZZ
domain.com/VVV-YYY-ZZZ.html
First URL is the dynamic format, latter is desired URL.
Can do it by adding extra bits to the URLs, like
domain.com/?typ=VVV
domain.com/VVV.html
domain.com/?typ=VVV&cat=YYY
domain.com/00-VVV-YYY.html
domain.com/?typ=VVV&cat=YYY&sct=ZZZ
domain.com/11-VVV-YYY-ZZZ.html
But, not otherwise.
So VVV is whatever the typ variable spits out, YYY the cat variable and ZZZ the sct variable.
David
So the script is now placing static-URL links on your pages, so that they may be clicked?
That is the first of the two most-often-required steps, with an optional third step, as outlined in the thread I cited above. If you haven't read that thread in-depth already, I commend it to you for a thorough, detailed read, as it addresses all aspects of this problem you're dealing with, and will likely give you a faster answer than having to walk through it step-by-step here.
As to your basic question, yes, it's possible to rewrite from static to dynamic, and to redirect from dynamic back to static, and that is most likely what you want to do if you want static URLs indexed in search engines for dynamically-created pages. And those steps are outlined in the cited thread.
Jim
Yes.
>If you haven't read that thread in-depth already, I commend it to you for a thorough, detailed read,
I've read the page several times and don't see an answer to the problem?
I've not uses rules with this format before though-
RewriteRule ^product/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?
Are you saying this is the problem that I can do what I want with that format?
>As to your basic question, yes, it's possible to rewrite from static to dynamic, and to redirect from dynamic back to static, and that is most likely what you want to do if you want static URLs indexed in search engines for dynamically-created pages. And those steps are outlined in the cited thread.
That's not what I asked.
This is a new script so don't have to deal with currently indexed dynamic pages (so no need for 301 redirects) and I'm not looking for static to dynamic rewrite rules. I just want dynamic to static URLs of a particular format using rewrite rules.
The difference between other scripts I've worked with is I'm trying for the format I listed previously which I think means the rewrite rules interfere with one another (I want to know if it's even possible to use that format).
Basically these three rules-
RewriteRule ^(.*)-(.*)-(.*).html?typ=$1&cat=$2&sct=$3 [QSA,L]
RewriteRule ^(.*)-(.*).html?typ=$1&cat=$2 [QSA,L]
RewriteRule ^(.*).html?typ=$1 [QSA,L]
So I get files with this structure-
1-2-3.html
1-2.html
1.html
The 3 rules work individually (so add just one to the .htaccess file and it works), but I can't get all three rules working at the same time.
Does that make sense?
If I change the rules and the script to create URLs like these-
uk-1-2-3.html
bob-1-2.html
1.html
Then it works, but I don't want to add the extra bits (uk and bob) if my preferred format is possible.
David