Results 1 to 11 of 11
  1. #1
    manik's Avatar
    manik is online now Om Shanti!
    Join Date
    Apr 2008
    Location
    Boston, USA
    Posts
    13,172
    Thanks
    744
    Thanked 699 Times in 550 Posts
    Blog Entries
    4
    Feedback Score
    4 (100%)

    Default Enable Url Rewriting on Apache Server 2.x

    I was spending last two hours looking for an article to activate url rewriting (mod_rewrite) on Apache server. I am not a apache server guy, so all the articles were talking something that was going over my head.

    Then I found this article showing a simple solution, Apache 2.2 and mod_rewrite Document As You Go

    Wordpress hosted blogs seem to vanish often. Just for that , copying the article here but credit goes to that blog.

    Code:
    This is a super short (and very rough) post on how to enable mod_rewrite in Apache 2.2.
     I have seen numerous posts on how to create “rewrite” scripts but found very little information on how to enable this feature in Apache 2.2.
     Step 1: Uncomment the line with “mod_rewrite.so” from httpd.conf
    LoadModule rewrite_module modules/mod_rewrite.so
    Step 2: Search for the keyword “.htaccess” and change the AllowOverride value
    AllowOverride All
    Step 3: Restart Apache and check if module has been loaded (LoadedModule section in phpinfo()) Step 4: Create a test .htaccess in your root directory
    Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^success\.html$ index.php [L]
    Step 5: Type http://localhost/success.html in your browser (change port info based on your setup) You should be able to see your index.php load up.
    Free Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK


  2. The Following User Says Thank You to manik For This Useful Post:

    Anas (05-17-2010)

  3. #2
    krates98's Avatar
    krates98 is offline Master
    Join Date
    Nov 2008
    Posts
    2,904
    Thanks
    58
    Thanked 53 Times in 40 Posts
    Feedback Score
    0

    Default

    i think now days control panels provide you options for enabling mod_rewrite and all u were needing it for local server ?

  4. #3
    Join Date
    Jan 2010
    Location
    Nepal
    Posts
    1,166
    Thanks
    15
    Thanked 22 Times in 22 Posts
    Feedback Score
    0

    Default

    Quote Originally Posted by krates98 View Post
    i think now days control panels provide you options for enabling mod_rewrite and all u were needing it for local server ?
    Ya ,
    Its easier to use url rewrite from Cpanel but some hosting provider may not provide Cpanel or host control interface which supports url rewrite in that case we can use this code.
    science and math : Mathematics
    biography of scientists : biography, math dictionary : dictionary

  5. #4
    Anas is offline Freshman
    Join Date
    Dec 2009
    Location
    Pakistan
    Posts
    22
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    thakyou very much friend ... it really helped me a lot ... I was wondering why any .htaccess files are not working on my server at all. After going through these instructions, It started working well!!!!!

  6. #5
    fostinwd is offline Junior
    Join Date
    Mar 2010
    Posts
    164
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

  7. #6
    fostin is offline Freshman
    Join Date
    Jul 2010
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

  8. #7
    Jerinjames is offline Banned
    Join Date
    Feb 2010
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    The following links also explain how we can setup mod_rewrite for URL Rewrting and can be used as reference for beginners.

    http://www.webreference.com/programming/Mod_Rewrite/
    http://www.tutorio.com/tutorial/enab...rite-on-apache



    Some servers will not have the module enabled by default. As long as the module is enabled and present in the apache configuration file, you can enable it simply by starting a .htaccess file with the command

    RewriteEngine on


    Put this .htaccess file in your root so that rewriting is enabled throughout your site. You only need to write this line once per .htaccess file.

  9. #8
    prptl709 is offline Sophomore
    Join Date
    Feb 2011
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Question Hi

    How to write the url in apache because I have no idea about that?

  10. #9
    jcourtenay's Avatar
    jcourtenay is online now Guardian
    Join Date
    Jan 2011
    Location
    Wirral, UK
    Posts
    3,665
    Thanks
    22
    Thanked 19 Times in 19 Posts
    Feedback Score
    0

    Default

    This kind of URL rewriting is normally used for redirecting old pages to new ones or domains without www to domains with www (or vice-versa). For example, if you wanted all requests to http://domain.com redirected to http://www.domain.com, you would put the following into .htaccess file and upload it to the root directory of your FTP Server:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    Free web space from Worlditsme, offering free web hosting packages and free php hosting

  11. #10
    kenjipro is offline Freshman
    Join Date
    Sep 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    If you installed Appserve on your PC !

    view fllowing : C:\AppServ\Apache2.2\conf

    And open file http.conf with notepad

    LoadModule negotiation_module modules/mod_negotiation.so
    #LoadModule rewrite_module modules/mod_rewrite.so
    LoadModule setenvif_module modules/mod_setenvif.so
    #LoadModule speling_module modules/mod_speling.so

    And modify to

    LoadModule negotiation_module modules/mod_negotiation.so
    #LoadModule rewrite_module modules/mod_rewrite.so
    LoadModule setenvif_module modules/mod_setenvif.so
    #LoadModule speling_module modules/mod_speling.so
    a

    nd save reastart apche ! and run localhost to test !

    You can using URL friendly on your local server !

  12. #11
    susyeileen is offline Freshman
    Join Date
    Sep 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    Depending on the software your server is running, you may already have access to URL rewriting modules. If not, most hosts will enable or install the relevant modules for you if you ask them very nicely.
    Apache is the easiest system to get URL rewriting running on. It usually comes with its own built-in URL rewriting module, mod_rewrite, enabled, and working with mod_rewrite is as simple as uploading correctly formatted and named text files.

Similar Threads

  1. What is Apache?
    By antonclovelly in forum Web Development - Programming & Coding
    Replies: 0
    Last Post: 05-17-2010, 06:29 AM
  2. URL rewriting..apache server..
    By seoladder in forum PHP
    Replies: 2
    Last Post: 05-15-2010, 12:02 AM
  3. Replies: 1
    Last Post: 02-02-2010, 11:18 AM
  4. Please, I need advice on which Server to get for work
    By bluewhale in forum Windows Server
    Replies: 0
    Last Post: 01-06-2010, 10:27 AM
  5. Windows Server 2008 Delivers Web-based Experiences
    By shovakoirala in forum Windows Server
    Replies: 7
    Last Post: 12-11-2009, 05:49 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •