Results 1 to 6 of 6

 

Thread: Mod Rewrite Help..

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Mar 2009
    Posts
    41
    Thanks
    4
    Thanked 1 Time in 1 Post


    Hey people,

    Im currently adding a mod rewite to my hta_access file and put in the following code, for some reason it wont work...

    RewriteEngine On
    RewriteRule ^([^/]*)$ /foldername/site.php?link=$1 [L]

    Foldername is the name of my folder and site.php is the name of the php file which connects to the database and displays the page.

    The url should change from :
    sitename.co.uk/foldername/site.php?databaselink=whatever

    to :
    sitename.co.uk/whatever

    But for some reason won't work..

    Any ideas?

  2. #2
    Registered User

    Status
    Offline
    Join Date
    May 2010
    Posts
    44
    Thanks
    0
    Thanked 7 Times in 7 Posts
    What if you do this:


    Code:
    RewriteEngine On
    RewriteBase /foldername/
    RewriteRule ^([^/]*)$ /foldername/site.php?link=$1 [L]

  3. #3
    Registered User

    Status
    Offline
    Join Date
    Mar 2009
    Posts
    41
    Thanks
    4
    Thanked 1 Time in 1 Post
    Hey there, ive just tried as suggested , but still no luck..

  4. #4
    Registered User

    Status
    Offline
    Join Date
    Mar 2009
    Posts
    41
    Thanks
    4
    Thanked 1 Time in 1 Post
    Ok this is my current htaccess data : (slightly edited ofcourse, for names of folders etc)

    # BEGIN WordPress


    # Link Cloaker Plugin BEGIN
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^link/([^/]*)/([0-9]+)/([0-9]+)/?$ http://www.sitename.co.uk/wordpress/wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?post_id=$2&link_num=$3&cloaked _url=$0 [L]

    RewriteRule ^link/([^/]+)[/]?$ http://www.sitename.co.uk/wordpress/wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?name=$1&cloaked_url=$0 [L]
    </IfModule>
    # Link Cloaker Plugin ENDS

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>


    RewriteCond %{HTTP_HOST} !^www\.sitename\.co.uk$
    RewriteRule (.*) http://www.sitename.co.uk/$1 [R=301,L]


    RewriteEngine On
    RewriteRule ^([^/]*)\.php$ /foldername/site.php?link=$1 [L]

    Now, the site redirects properly non www to a www site fine, and the links are masked as well, its just the last statement which wont work, trying to create better structured permalinks from a database php.

    Im sure its something obvious,but just cant seem to work it out...

  5. #5
    Registered User

    Status
    Offline
    Join Date
    May 2010
    Posts
    44
    Thanks
    0
    Thanked 7 Times in 7 Posts
    I must admit this stuff always makes me scratch my head!

    Could you try this, go into your foldername directory create a new htaccess file and put the following:

    Code:
    RewriteEngine on
    RewriteBase /foldername/
    RewriteRule ^([^/]*)$ site.php?link=$1 [L]
    It won't get rid of the foldername folder for now, i just want to test that you can get to the link like : www.sitename.co.uk/foldername/$1

  6. #6
    Registered User

    Status
    Offline
    Join Date
    Mar 2009
    Posts
    41
    Thanks
    4
    Thanked 1 Time in 1 Post
    Ok..ive been looking into things and may have found the problem, just need the solution now!

    Basically, the site im writing the htacess for is an add on domain, so presumable i need the rewrite base or something to by pass the main site and treat this add on site as seperate..the question is how!?



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Content Relevant URLs by vBSEO 3.5.0 RC2