Jump to content

Recommended Posts

Hi All,

So far the following line works.

RewriteRule go-and-fetch([.*]) search.php$1  [L]

What I want to is refining the variable because its contents is not user friendly enough. For example it might look like

?options=del&cat=tech&code=teinte_id_005

So I tried this line, which does not work

RewriteRule go-and-fetch-tech-([.*]) search.php?options=del&cat=tech&code=$1  [L]

Note that the following line would work :

RewriteRule go-and-fetch-tech-teinte_id_005 search.php?options=del&cat=tech&code=teinte_id_005 [L]

Thanks !

 

 

Link to comment
https://forums.phpfreaks.com/topic/307737-variable-not-processed-in-htaccess/
Share on other sites

7 hours ago, phdphd said:

So far the following line works.


RewriteRule go-and-fetch([.*]) search.php$1  [L]

 

No, I don't believe it does.

 

What is the URL you want to see in the address bar and what is the URL it needs to be translated to by the server?

39 minutes ago, requinix said:

 

No, I don't believe it does.

 

What is the URL you want to see in the address bar and what is the URL it needs to be translated to by the server?

Hi Requinix,

First of all, thanks a lot for coming again to my rescue. Much appreciated.

What you wrote is very interesting & instructive.

When I started to build my htaccess file I wrote a line that looks like....

RewriteRule go-and-fetch search.php  [L]

... in order for the URL to look user friendly from the very first time the page would be loaded.

It turned out that afterwards I made some updates to my page essentially by designing an area that gathers the criteria chosen by the user and where they can selectively click a specific criterion to delete it. That is where comes into play the "?options=xxxxx" part of the URL.

So to keep the user-friendly URL also in the cases where the user deletes a criterion, I thought I needed to add the following line

RewriteRule go-and-fetch([.*]) search.php$1  [L]

Actually this line seems useless. I have just made some tests with just the other line enabled, and "go-and-fetch" always displays in the address bar either alone (like when first loading of the page) or followed by the  "?options=xxxxx" part that corresponds to the criteria that the user clicked in order to delete it.

5 minutes ago, requinix said:

If you're just adding a query string, so go-and-fetch?options=whatever, then you don't have to do anything in your .htaccess.

Yes. And to make the query string more user friendly, I removed the square brackets.

RewriteRule go-and-fetch-tech-(.*) search.php?options=del&cat=tech&code=$1 [L]

You cannot make a query string more friendly. Well, you can, but not in the way you're thinking. What you do is not use a query string at all.

What you have now means something like go-and-fetch-tech-123 will go to search.php. Is there a problem with it? Are you going to crusade against query strings and anything else that doesn't look readable?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.