Results 1 to 9 of 9
  1. #1

    Exclamation .htaccess rewrite help required

    hi,

    i followed this tutorial to get a dynamic php site going, but i cannot figure out how i can make the dynamic urls static

    i need a rewriterule that can change
    http://www.mysite.com/?page=index
    to something like
    http://www.mysite.com/index
    (afcource this is just an example url and not my site)

    i know this is possible, but i do not understand why it does not work, and i also observed some stuff on google but i don't understand a bit from those

    so please help if you can, and if possible also explain your .htaccess rewrite script

  2. #2
    Join Date
    Aug 2010
    Location
    Brussels, Belgium
    Posts
    162
    Hi,

    Try this:
    Code:
    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^page=(.*)$
    RewriteRule ^$ http://www.mysite.com/%1? [L,R=301]
    Jean-Luc
    www.StreamAnalyst.com
    * viewers statistics for your video streaming (live and on-demand)
    * listeners statistics for your internet radio
    * supporting Wowza, Amazon CloudFront, Icecast, SHOUTcast, Unreal and more

  3. #3
    Join Date
    Feb 2005
    Location
    Wales
    Posts
    48
    Also make sure mod_rewite is running, do this by putting <?php phpinfo(); ?> in to a test php file then open it and check the "Loaded Modules" secton
    • Web Hosting Broker
    • 100% Free web hosting advice from industry experts
    Web hosting advice

  4. #4
    Join Date
    May 2014
    Posts
    31

    Post

    Just to add more Jean-Luc answer

    Add this:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    To prevent the rewrite broke your file and folder path.
    Last edited by idnx; 05-12-2014 at 01:42 AM.

  5. #5

    *

    Quote Originally Posted by 200-ok View Post
    Hi,

    Try this:
    Code:
    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^page=(.*)$
    RewriteRule ^$ http://www.mysite.com/%1? [L,R=301]
    Jean-Luc
    thanks, it works, but i got no idea why it does

    can you explain what it does? :O
    e.g. "[L,R=301]"


    and idnx, thanks to you to

    although i have no clue what it does

  6. #6
    i spoke to soon, it appears not to work :O

    strangely
    http://demo.queztech.net/
    works but with the above help
    http://demo.queztech.net/index.html
    does not

    and i still dont know how it works :O

  7. #7
    Join Date
    May 2014
    Posts
    31
    That to prevent file or folder to be rewritten too by mod_rewrite.

    if you have folder /img but you do not tell mod_rewrite to ignore folder or file, it will make your folder or file not accessible.

    When you try to access:

    mysite/img

    mod_rewrite will give you:

    mysite/?page=img

    CMIIW

  8. #8
    Join Date
    May 2014
    Posts
    31
    Quote Originally Posted by Quezler View Post
    i spoke to soon, it appears not to work :O

    strangely
    http://demo.queztech.net/
    works but with the above help
    http://demo.queztech.net/index.html
    does not

    and i still dont know how it works :O
    That rule not work for above condition.

    does the file (index.html) exist?

    BTW can you post entire of .htaccess file?

  9. #9
    try with the help of wordpress htaccess file.Most of the code don't work

Similar Threads

  1. htaccess rewrite
    By greatdedserver in forum Hosting Security and Technology
    Replies: 6
    Last Post: 10-29-2012, 02:32 AM
  2. .htaccess Rewrite
    By web_hosting4u in forum Hosting Security and Technology
    Replies: 5
    Last Post: 09-09-2008, 03:52 AM
  3. help with htaccess rewrite
    By kafloofen in forum Hosting Security and Technology
    Replies: 1
    Last Post: 01-17-2008, 12:54 PM
  4. htaccess rewrite
    By HD Fanatic in forum Hosting Security and Technology
    Replies: 2
    Last Post: 03-14-2007, 11:31 AM
  5. rewrite using .htaccess
    By aawebtools in forum Dedicated Server
    Replies: 2
    Last Post: 05-22-2001, 08:40 AM

Posting Permissions

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