EvilZone
Programming and Scripting => Web Oriented Coding => : The Alchemist June 12, 2013, 12:48:36 PM
-
I want to do some mod_rewrite on my site. But, I'm new to using .htaccess
I want to change the URL
http://scriptings.tk/paste/viewcode.php?id=5190da909e5b1
to
http://scriptings.tk/paste/5190da909e5b1
So that whenever a user requests
http://www.scriptings.tk/paste/<id> (http://www.scriptings.tk/paste/viewcode.php?id=5190da909e5b1)
The result of
http://www.scriptings.tk/paste/viewcode.php?id=<id> (http://www.scriptings.tk/paste/viewcode.php?id=5190da909e5b1)
is displayed...
Where <id> is an alphanumeric string.
Will this be the sufficient and working mod_rewrite code ?
RewriteEngine On
RewriteRule ^paste/([^/]*)$ /paste/viewcode.php?id=$1 [L]
And do I just need to add this to my .htaccess of my server thats located in public_html folder?
-
First be sure that you can indeed use .htaccess (witch is in fact a override).
EDIT:
try deny from all
-
First be sure that you can indeed use .htaccess (witch is in fact a override).
EDIT:
try deny from all
I tried using the above code that I posted.
When I make the .htaccess file and add the code to it, both the URLs http://scriptings.tk/paste/viewcode.php?id=5190da909e5b1
as well as
http://scriptings.tk/paste/5190da909e5b1
are displaying 404 errors.
So, does this mean its usable?