Some Mod Rewrite Codes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ceesil

    Some Mod Rewrite Codes

    Well I am posting some Mod Rewrite Codes which can be helpful to you all.

    \ - Next metacharacter
    . - Match any character except newline
    ^ - Beginning of the line
    $ - Ending of the line
    | - Alternation
    () - Grouping
    [] - Character cl***
    ? - 0 or 1 of the preceding text
    * - 0 or N of the preceding text (N > 0)
    + - 1 or N of the preceding text (N > 1)
    [NC] - No Case sensitive
    [OR] - OR next condition
    [R] - Force 302 redirect
    [F] - Force URL to be 403 forbidden
    [G] - Force URL to be Gone
    [L] - Last rule - don't apply any more rewriting rules
    [P] - Force proxy

    do post more if you all great programmers have them.
  • kevin
    Love is life
    • Dec 2015
    • 83

    #2
    The Apache module mod_rewrite provides a powerful way to do URL manipulations. With it you can do nearly all types of URL manipulations. The price you have to pay is to accept complexity, because mod_rewrite's major drawback is that it is not easy to understand and use for the beginner.

    Apache supports an unlimited number of rules and an unlimited number of conditions for each rule to provide a really flexible and powerful URL manipulation mechanism. The URL manipulations can depend on various tests, for instance server variables, environment variables, HTTP headers, time stamps and even external database lookups in various formats can be used to achieve a really granular URL matching.

    These modes an be set for both on server end (httpd.conf) and per-directory context (.htaccess).

    I am giving simple example to make SEO friendly URL by rewriting:-

    Suppose you have URL like this:-


    and you want to make it search engine friendly, then you need to write .htaccess file and upload in the web site as belwo:-

    RewriteEngine On
    RewriteRule ^resources/advertising(.*)$ index.php?c=3 [L,NC]

    and it will write it as belwo:-


    You can also read some postings of mine here on MOD-REWRITE in the ASP.net directory building...

    Hi everyone ... my programming team is planning to prepare web directory in asp.net ... I need to give them suggestion ... to make asp.net directory crawlable ... what things should be kept in mind to make it search engine friendly ... Can anyone suggest me so that i can p*** it on to my programme team ...

    Comment

    Working...
    😀
    😂
    🥰
    😘
    🤢
    😎
    😞
    😡
    👍
    👎