Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    827
    Thanks
    93
    Thanked 18 Times in 18 Posts

    Simple rewrite problem

    I need to make a simple rewrite apache rule so anything after #! in the URL gets redirected to index.php?page={TheString}

    I tried this

    RewriteEngine on
    RewriteRule ^/([0-9][0-9])/$ http://localhost/221New/test.php?page=$1

    but i get a 500 server error, can anyone see why or would i need to post more code? thats all i currently have in my htaccess file
    Last edited by tomharto; 01-16-2012 at 12:02 PM.

  2. #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,650
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Check your error log. You may not have mod_rewrite installed/enabled.

  3. #3
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    827
    Thanks
    93
    Thanked 18 Times in 18 Posts
    The error i get is

    [Mon Jan 16 14:46:20 2012] [alert] [client ::1] /Applications/XAMPP/xamppfiles/htdocs/221New/.htaccess: Invalid command '{\\rtf1\\mac\\ansicpg10000\\cocoartf824\\cocoasubrtf480', perhaps misspelled or defined by a module not included in the server configuration


    I guess that means its not installed? Im using XAMPP, how would i go about installing it on there?

  4. #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,650
    Thanks
    2
    Thanked 406 Times in 398 Posts
    This page explains how to enable AllowOverride on OSX: http://blog.1on1.ro/2008/02/25/enabl...x-105-leopard/

    Your httpd.conf is like in this folder: /Applications/XAMPP/ or /Applications/XAMPP/apache rather than the path they mention.

  5. Users who have thanked Inigoesdr for this post:

    tomharto (01-17-2012)

  6. #5
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    827
    Thanks
    93
    Thanked 18 Times in 18 Posts
    Thanks, that helped apache now seems to be running okay.

    Im having a little trouble with writing the rule though, i need it to pick up uppercase letters, lowercase letters and underscores what are after #! so i tried RewriteRule ^#!([a-zA-Z_])$ test.php?page=$1 but that didnt work, can you see what im doing wrong?

  7. #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    15,006
    Thanks
    164
    Thanked 2,244 Times in 2,231 Posts
    what are after #!
    Anything after the character # in the url won't be passed to the server.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  8. #7
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    827
    Thanks
    93
    Thanked 18 Times in 18 Posts
    Yeah just did a bit of research and found that out , time to rethink my plan


 

Posting Permissions

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