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: Rewrite rule
Author
edgar



Joined: 08 Jun 2014
Posts: 2

PostPosted: Sun 08 Jun '14 21:37    Post subject: Rewrite rule Reply with quote

Hi. I've install an apache2 on a ubuntu server, but my question is very apache2 specific so that's why I place it here.

I need to have a rewrite rule and I can't get it correct.

Start url:
Code:
http://192.168.2.200:9000/api?apikey=3f9d038837d22ecc13ac17702472298d&t=tvsearch&cat=5030%2C5040

End url:
Code:
http://192.168.2.200:9000/index.php?page=newznabapi&apikey=3f9d038837d22ecc13ac17702472298d&t=tvsearch&cat=5030%2C5040

As you can see I nee to replace "api" with "index.php?page=newznabapi&". Can someone advice? I've been looking on it a couple of hours but every time get stuck on the special characters, or the port being removed... Everything coming after apikey can be different

Oh yes ofcourse, the setup. We I've this entry in my apache2.conf (the rewrite module is working)
Code:
<Directory /var/www/spotweb/>
        RewriteEngine on
        RewriteCond %{REQUEST_URI} !api/
        RewriteRule ^192.168.2.200:9000/api?$ 192.168.2.200:9000/index.php?page=newznabapi&$1
        Options Indexes FollowSymLinks Multiviews
        AllowOverride None
        Order allow,deny
        allow from all
</Directory>

Currently I've a ugly test in the RewriteRule line
Back to top
James Blond
Moderator


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

PostPosted: Tue 10 Jun '14 23:04    Post subject: Reply with quote

The ! is for excluding. Your condition excludes

so you may try
Code:

RewriteCond %{REQUEST_URI} !^/index.php(.*)$
RewriteRule ^/api(.*)$ /index.php?$1
Back to top
edgar



Joined: 08 Jun 2014
Posts: 2

PostPosted: Wed 11 Jun '14 15:05    Post subject: Reply with quote

Thanks for the replies. I think with these I can get it functioning better.
Back to top


Reply to topic   Topic: Rewrite rule View previous topic :: View next topic
Post new topic   Forum Index -> Apache