Forum Moderators: phranque
…site.com/?var1=A&var2=B&var3=C
or
…site.com/page.html?var1=A&var2=B&var3=C
or
…site.com/subfolder/page.html?var1=A&var2=B&var3=C
can I rewrite them through .htaccess so they are seen by search engines without variables while my server continues passing them from page to page and out like it does now? Can clean URL be achieved in this way?
Thanks
So the short answer is "no," because the server would have no idea of what content was being requested if you dropped the *information* previously carried by the query string.
You can, however, publish the URL in a different form, such as
example.com/subfolder/page-A-B-C
or similar, and then internally rewrite that back to
example.com/subfolder/page.html?var1=A&var2=B&var3=C
inside your server, so that the scripts on your server will still work properly.
(This assumes that the three variables are always in the same order, by the way).
Jim
In this case we have static HTML pages, so variables do not influence the content in any way. All of the variables are like keywords, search engine or other referring URLs, click time, etc. Based on this, with, or without variables, the landing page will be the same.
That is why I thought I could make a statement in .htaccess which would “hide” variables. The way how it works now is that they are attached to the URL and that parser (written in Perl) parses HTML in order to insert them into all links (internal and outgoing). The final result is that we get those variables out and see them when a sale happens.
I am thinking about having a cookie instead of attaching everything to the URL, but thought we should test URL rewriting as well.
Thanks
Mod_rewrite executes after a link is clicked and the request for that URL arrives at your server; mod_rewrite can redirect to a new URL, or rewrite an incoming URL to a non-default filepath, but is has no effect on the 'output' content of your pages.
Jim