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: No Clean URLs with rewrite
Author
Sinuouser



Joined: 19 Aug 2015
Posts: 1
Location: Sweden, Stockholm

PostPosted: Wed 19 Aug '15 19:50    Post subject: No Clean URLs with rewrite Reply with quote

I'm using Ubuntu 15.04 with Apache 2.4.10.

Having some issues with Clean URLs when using rewrite.
The redirects are working, but it's rewriting the address in the browser, to show the not-so-pretty GET address.

I've been trying a bunch of different stuff, but at the moment my /etc/apache2/sites-available/000-default.conf contains;
Code:

<Directory /var/www/boir>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Require all granted
    RewriteEngine On
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{ENV:REDIRECT_STATUS} 200 
      RewriteRule ^ - [L]
    RewriteRule ^daily/?$ http://sinuouser.com/boir/index.php?daily=true [L]
    RewriteRule ^daily/(.*)$ http://sinuouser.com/boir/index.php?daily=true&date=$1 [L]
</Directory>


The site in question is http://sinuouser.com/boir, the button "Daily" goes to http://sinuouser.com/boir/daily, which correctly is rewritten to http://sinuouser.com/boir/index.php?daily=true, but it also updates the address bar in the browser, which kinda defeats the purpose of having Clean URLs through RewriteRules...

I'd be grateful for any hints and help on this issue!

//Rickard

Edit: Link formatting, Updated conf code to try for specific directory; didn't work either
Back to top
James Blond
Moderator


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

PostPosted: Sat 24 Oct '15 13:55    Post subject: Reply with quote

The URLS in the HTML code need to be clean, too.
Back to top
walt



Joined: 24 Oct 2015
Posts: 25

PostPosted: Sat 24 Oct '15 17:41    Post subject: Reply with quote

At least this line should to do what you want if you replace [L] with [P]:
Code:
RewriteRule ^daily/(.*)$ http://sinuouser.com/boir/index.php?daily=true&date=$1 [P]

However, see the security warning here. You might want to add a rule to not accept certain characters, as is described here: Blacklist via Request URI.
Back to top


Reply to topic   Topic: No Clean URLs with rewrite View previous topic :: View next topic
Post new topic   Forum Index -> Apache