logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: clean url okay, but no <a href requests works in the brow
Author
Adrian_u



Joined: 27 Mar 2020
Posts: 4
Location: Utrecht

PostPosted: Sat 28 Mar '20 12:14    Post subject: clean url okay, but no <a href requests works in the brow Reply with quote

my apache environment:

- apache versie : 3.1.9 64 bit
- windows 10
- log files; cant make any sense of it
- php version 7.3.5

the htaccess code

Code:


IndexOptions +FancyIndexing
RewriteEngine On
 
RewriteCond %{QUERY_STRING} query_var=query_param [NC]

#RewriteCond %{QUERY_STRING} query_var=(\w) [NC]
 
RewriteRule ^index_page /subdir2/index_page/ [QSD,R=302,L]




the commented rule is the rule that goes wrong.
When I use it, the query and param are not showed in the browser address bar.
The $_GET query is part of a menu called with a php/html <a href link, but only the start/default page of the menu is showed.
When using regex it collapses, and when resetting it back to the first query_var=query_param setting I get a clean url but only 1 php page showing up
I tried the following:
query_var=(/w)

but reading and googeling more and more makes me think it could be due to apache sever caching, as it works 1 time and then not anymore.

positive : url address bar is clean, the way its intended
negative: the pages are not called within the html/php menu except the landing page

I have been searching a lot online with google but cant find a solution so I would like to ask any kind of help from here to solve it. Anyone got an idea?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Sat 28 Mar '20 15:29    Post subject: Re: clean url okay, but no <a href requests works in the Reply with quote

Adrian_u wrote:
.
When I use it, the query and param are not showed in the browser address bar.


What browser do you use? Not all browses show that values until you click into the url bar...

A good way is to use the developer tools from your browser to check for those things.

How ever QSD removes the Query string. I think you should use QSA.
Back to top
Adrian_u



Joined: 27 Mar 2020
Posts: 4
Location: Utrecht

PostPosted: Sat 28 Mar '20 16:31    Post subject: Re: clean url okay, but no <a href requests works in the Reply with quote

I tested it with several browsers: Edge, Chrome and Brave.
They all give the same output


Last edited by Adrian_u on Sat 28 Mar '20 17:06; edited 1 time in total
Back to top
Adrian_u



Joined: 27 Mar 2020
Posts: 4
Location: Utrecht

PostPosted: Sat 28 Mar '20 16:58    Post subject: Reply with quote

Is it possible that a rewrite rule writes it to an older folder that is not used in any rule?

I'm sure its possible because the rewrite rule send it to a directory that is not in the htaccess script. How is this ever possible?
Is that the server cache?
Can I clean it ?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Sun 29 Mar '20 17:46    Post subject: Reply with quote

There is no cache if you use .htaccess for rewrite. If you have it in your server config, you need to restart apache.

an exanple

Code:

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


here every query is added to q= to index.php
Th first line excludes the index.php itself from rewrite

See also https://www.apachelounge.com/viewtopic.php?t=6688&highlight=exclude

https://www.apachelounge.com/viewtopic.php?t=3168&highlight=exclude

https://www.apachelounge.com/viewtopic.php?t=5184&highlight=exclude

if you still have a question ask again.
Back to top
Adrian_u



Joined: 27 Mar 2020
Posts: 4
Location: Utrecht

PostPosted: Tue 31 Mar '20 10:07    Post subject: Reply with quote

Well the answer you give does not answer the question in the opening post.
Not sure if my question is not clear maybe?

Would you like me to ask the question in a better and more clear way?
Back to top


Reply to topic   Topic: clean url okay, but no <a href requests works in the brow View previous topic :: View next topic
Post new topic   Forum Index -> Apache