Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

data structure cp 403

Rating
-
Sold
-
Pages
2
Uploaded on
22-02-2025
Written in
2019/2020

data structure cp 403 notes

Institution
Course

Content preview

mod_rewrite Cheat Sheet
by Dave Child (DaveChild) via cheatography.com/1/cs/4/


mod_re​write Tutorials Redire​ction Header Codes mod_re​write Server Variables: HTTP
Headers
http:/​/ht​tpd.ap​ach​e.o​rg/​doc​s/c​urr​ent​/re​write/ 301 Moved perman​ently
http:/​/ww​w.a​dde​dby​tes.co​m/f​or-​beg​inn​‐ 302 Moved tempor​arily (default) %{HTTP​_US​ER_​AGENT}
ers​/ur​l-r​ewr​iti​ng-​for​-be​gin​ners/ %{HTTP​_RE​FERER}

http:/​/ne​t.t​uts​plu​s.c​om/​tut​ori​als​/ot​her​/a-​dee​‐ mod_re​write Directives %{HTTP​_CO​OKIE}
per​-lo​ok-​at-​mod​_re​wri​te-​for​-ap​ache/ Rewrit​eEngine RewriteMap %{HTTP​_FO​RWA​RDED}
Rewrit​eOp​tions Rewrit​eBase %{HTTP​_HOST}
mod_re​write Rewrit​eRule Flags
RewriteLog Rewrit​eCond %{HTTP​_PR​OXY​_CO​NNE​CTION}
C Chained with next rule
Rewrit​eLo​gLevel Rewrit​eRule %{HTTP​_AC​CEPT}
CO=cookie Set specified cookie
Rewrit​eLock
E=var:​‐ Set enviro​nmental variable mod_re​write Server Variables: Server
value “var” to “value” Regular Expres​sions Syntax Internals
F Forbidden (403 header) %{DOCU​MEN​T_ROOT}
^ Start of string
G Gone - no longer exists %{SERV​ER_​ADMIN}
$ End of string
H=handler Set handler %{SERV​ER_​NAME}
. Any single character
L Last - stop processing rules %{SERV​ER_​ADDR}
(a|b) a or b
N Next - continue processing %{SERV​ER_​PORT}
(...) Group section
NC Case insens​itive %{SERV​ER_​PRO​TOCOL}
[abc] In range (a, b or c)
NE Do not escape output %{SERV​ER_​SOF​TWARE}
[^abc] Not in range
NS Ignore if subrequest
\s White space
P Proxy mod_re​write Sample Rule: Site Moved
a? Zero or one of a
PT Pass through # Site moved perman​ently
a* Zero or more of a
R[=code] Redirect to new URL, with Rewrit​eCond %{HTTP​_HOST} ^www.d​oma​‐
a*? Zero or more, ungreedy
optional code (see below) in.com$ [NC]
a+ One or more of a
QSA Append query string Rewrit​eRule ^(.*)$ http:/​/ww​w.d​oma​‐
a+? One or more, ungreedy
in2.com/$1 [R=301,L]
S=x Skip next x rules
a{3} Exactly 3 of a
T=mime​- Set mime type Rewrites domain.com to domain​2.com
a{3,} 3 or more of a
type
a{,6} Up to 6 of a mod_re​write Sample Rule: Temporary Page

mod_re​write Rewrit​eCond Flags a{3,6} 3 to 6 of a Move

NC Case insens​itive a{3,6}? 3 to 6 of a, ungreedy # Page has moved tempor​arily

OR Combine with next rule using 'OR' \ Escape character Rewrit​eRule ^page.h​tml$ new_pa​ge.html
instead of the default of 'AND' [R,NC,L]
[:punct:] Any punctu​ation symbol
[:space:] Any space character Rewrites domain.co​m/p​age.html to
domain.co​m/n​ew_​pag​e.html
[:blank:] Space or tab

There's an excellent regular expression
tester at: http:/​/re​gex​pal.com/


By Dave Child (DaveChild) Published 19th October, 2011. Sponsored by Readable.com
cheatography.com/davechild/ Last updated 25th February, 2020. Measure your website readability!
aloneonahill.com Page 1 of 2. https://readable.com

Written for

Institution
Course

Document information

Uploaded on
February 22, 2025
Number of pages
2
Written in
2019/2020
Type
Class notes
Professor(s)
Ram
Contains
All classes

Subjects

$9.19
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
ajay17

Get to know the seller

Seller avatar
ajay17
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions