Jump to content

Recommended Posts

There are plenty written tutorials out there. Here is one:

 

http://corz.org/serv/tricks/htaccess2.php

 

Please, do not ask people to write stuff for you. If you are willing to pay, post in the freelance. If you need help with a current script ask. But if you are not willing to google / read why should anyone else be willing to do that for you without payment?

You are right... there are plenty but none worked for me :D

 

and for your information ....

I've Googled so much about it months ago and all i find was non-working bullshit

even find a site that generated the script by writing what you need like ?ip= blablah and it didnt worked :D

 

in the end i  did find a script that works partially....

 

Here it is... :

 

Options +FollowSymLinks -MultiViews
RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?ip=([^&]+)(&.*)?$ [NC]

RewriteRule ^Track.php /Track/%2? [R=301,L]

RewriteRule ^Track/([^&]+)$ /Track.php?ip=$1 [L]

 

But its not working right :D

 

heres how it acts...

 

So you browse to

http://MyWebSite.net/Track.php

Submit the form and it generates :

http://MyWebSite.net/Track/AA.BB.CC.DD

 

i need to set Track.php as Track and be able to browse to Track...

 

anyone has an idea how may i remove its extension and do that ?

 

why should anyone else be willing to do that for you without payment?

 

Because This kind of Script takes a VERY Small amount of time for someone that knows Apache in my opinion

And... its a Support Forum when ppls help each other ! :)

not everyone is as greedy as you and asking for payments in exchange of support :P

 

Your original post would have been much better received if you had posted what you did in your last reply, showing that you have at least made an effort.

I Wroted that fast ...

I thought that it will be too simple for someone who knows Apache to write a few lines of script for that

 

I thought that it will be too simple for someone who knows Apache to write a few lines of script for that

 

It would be, but it wouldn't teach you how to write your own rules which defies the purpose.

 

Wouldn't you rather read a few tutorials and actually learn what you are doing so that next time you don't need to come and ask someone else to do it for you again?

  • 1 month later...

The rewrite rule for http://MyWebSite.net/Track/AA.BB.CC.DD

 

Would be

RewriteRule Track/([a-z0-9.]+) track.php?ip=$1 [NC,L]

 

To get AA.BB.CC.DD from the url you'd use $_GET['ip']

 

 

hi

i appreciate you've replyed but your script dosnt do anything

 

the one i posted here in a previous post works ok in creating

 

http://MyWebSite.net/Track/AA.BB.CC.DD

 

but ONLY When the get form is submitted

is there a way to get

http://MyWebSite.net/Track/

to point from Track.php

to browse directly to http://MyWebSite.net/Track/

without the form beeing submitted

  • 2 weeks later...

Do not be under the assumption mod_rewrite will change your urls for you!

It will not automatically change the url form http://MyWebSite.net/track.php?ip=AA.BB.CC.DD to http://MyWebSite.net/Track/AA.BB.CC.DD.

It will only map the url http://MyWebSite.net/Track/AA.BB.CC.DD to http://MyWebSite.net/track.php?ip=AA.BB.CC.DD

 

hi

i appreciate you've replyed but your script dosnt do anything

 

the one i posted here in a previous post works ok in creating

 

http://MyWebSite.net/Track/AA.BB.CC.DD

 

but ONLY When the get form is submitted

is there a way to get

http://MyWebSite.net/Track/

to point from Track.php

to browse directly to http://MyWebSite.net/Track/

without the form beeing submitted

I don't understand what you mean

 

well let me try again to explain more clearly

 

I Want to change :

http://MyWebSite.net/Track.php

To:

http://MyWebSite.net/Track

 

And When the Form Submits to Create this link:

http://MyWebSite.net/Track/AA.BB.CC.DD

 

NOT

 

http://MyWebSite.net/Track.php?ip=AA.BB.CC.DD

You'll need to use javascript to override the browsers default behaviour of submitting the form to track.php?ip=AA.BB.CC.DD

 

Give your form an id of ip_form and the text input field an id of id. So you form is

 

    <form id="ip_form" action="track.php">        <input type="text" name="ip" id="ip" value="" />        <input type="submit" name="submit" value="submit" />    </form>

 

 

Now place the following code AFTER your form

 

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>    <script type="text/javascript">        $('#ip_form').submit(function() {            this.action = '/Track/' + $('#ip').val();        });    </script>

 

 

This will now make your form submit to site.com/Track/ipadresshere

Thank You Wild but its not what i want to do... and it isnt working as you are saying

 

For Example the link http://localhost.net/Track/

 

is getting a 404 error

 

And when i submit the Form it generates

http://localhost.net/Track/79.113.108.166?ip=79.113.108.166

 

but http://localhost.net/Track/79.113.108.166 isnt working also

 

The htaccess Script i posted works almost Fine

 

it only needs to Transform Track.php into Track So you could browse to Track

 

 

Change the javascript to

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript">
        $('#ip_form').submit(function() {
            window.location = '/testkiller/Track/' + $('#ip').val();
            return false;
        });
    </script>

 

This will be your .htaccess file

RewriteEngine On

RewriteRule ^Track/([a-z0-9.]+)/?$ track.php?ip=$1 [NC,L]
RewriteRule ^Track/?$ track.php [NC,L]

 

Go to http://site.com/Track/. Fill in the form with an ipaddress. It should redirect to http://site.com/Track/AA.BB.CC.DD

 

i had found this script before i started this topic that works partially....

 

 

Options +FollowSymLinks -MultiViews
RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?ip=([^&]+)(&.*)?$ [NC]

RewriteRule ^Track.php /Track/%2? [R=301,L]

RewriteRule ^Track/([^&]+)$ /Track.php?ip=$1 [L]

 

This is what it dos ...

 

So you Browse to

 

http://llocalhost/Track.php

 

Submit the GET Form and it Changes the link to :

http://llocalhost/Track/79.113.109.162

 

 

 

I Want to browse to

http://llocalhost/Track

And

When i submit the form to create

 

http://llocalhost/Track/79.113.109.162

Try out the following

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_URI} track\.php$ [NC,OR] 
RewriteCond %{QUERY_STRING} ip\=([^&]+)(&.*)?$ [NC]
RewriteRule . Track/%1? [NC,R,L]

RewriteRule ^Track/([a-z0-9.]+)/?$ track.php?ip=$1 [NC,L]
RewriteRule ^Track/?$ track.php [NC,L]

 

If you go to site.com/track.php it should redirect you to sitre.com/Track/

 

Submitting the form will go to site.com/Track/AA.BB.CC.DD

Thank You  !!

 

That Works as i wanted it only has a very small bug

 

When i browse to

http://localhost/Track.php

it redirects me to

http://localhost/home/USER/domains/wheresmyip.net/public_html/Track/

and not

http://localhost/Track.php

 

 

 

The rest Works as it should .. Browsing to Track And adding the IP after is working fine

 

 

 

Also i just noticed that the Script wont Work on my Windows machine

 

it gives this error in the apache error log

[Wed Sep 08 17:05:47 2010] [alert] [client 127.0.0.1] C:/wamp/www/IP/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration, referer: http://localhost/

 

And this on the page

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

 

 

On my Linux Hosting place it works fine

 

Do i need to add/activate a module or something ?

 

Edit:

 

i came around this

 

http://www.webmasterworld.com/forum92/925.htm

 

and activated the rewrite_module and it wont show that error again ....

 

and i can browse to Track but on submit it submits to

http://localhost/C:/wamp/www/IP/Track/

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.