Mod Rewrite

Started on the old forum in January 2010 · view the original in the archive · old links redirect here

No replies · 696 views · started 16 years ago · 1 min read

bOrN2pwn Developer · 230 posts #1

REQUIRED: Internet server (Apache 1.3.33 recomended), php, basic skills with .htaccess

Mod rewrite is cool Apache option, it helps you to make your site URL's simple and clean... also it is perfect for search engines...

This is mod rewrite, it replaces :

site.com/index.php?include=files?ID=45

with:

site.com/files/45

so lets get started, open notepad, enter this in it:

RewriteEngine On // - you are starting rewrite mod :)
RewriteBase / // - you set the rewrite base
RewriteRule ^(.+)/([0-9]+)/?$ index.php?include=$1&ID=$2 // and rule:
// ^(.+) - text ONLY
// ([0-9]+) - numbers ONLY

DON'T INCLUDE MY COMMENTS IN REAL HTACCESS!!

RewriteEngine On
RewriteBase /
RewriteRule ^(.+)/([0-9]+)/?$ index.php?include=$1&ID=$2

save it as: .htaccess and upload it to the root directory... and that's all work😑

IMPORTANT: there is problem with browsers, browsers don't recognize that folders you typed are not real so there is problem with images and css style, so just include absolute path this is only basic, if you really wanna do some serious work with mod rewrite visit: URL Rewriting Guide - Apache HTTP Server

as you can see this is also static URL, but can we be sure?8)

BakGat

class Counter {
public:
  void Count();
  int  ReadDisplay();
private:
  int  CurrentCount;
};

External image (may be gone) External image (may be gone) External image (may be gone)

Back up my hard drive? How do I put it in reverse? http://www.hackthissite.org Profile…

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close