.htaccess cleanurl help needed

7 replies
Hey warriors,
I needed a help with the mod_rewrite rules..

My url looks like this:
Code:
site.com/tests/check2.php?name=warriors
I wanted a clean url like this:
Code:
site.com/tests/warriors
Can anyone please provide me the .htaccess code to get a result like that?

I google searched & i found some script, they din't work.. may be there were some errors in the made which i could not manipulate

Thanks
#cleanurl #htaccess #needed
  • Profile picture of the author scriptkid
    Additional details

    i used this:

    RewriteEngine On
    RewriteRule /tests/(.*)$ /tests/check2.php?name=$1
    But this doesn't seem to work
    {{ DiscussionBoard.errors[5047393].message }}
  • Profile picture of the author Michael71
    Signature

    HTML/CSS/jQuery/ZURB Foundation/Twitter Bootstrap/Wordpress/Frontend Performance Optimizing
    ---
    Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu

    {{ DiscussionBoard.errors[5047404].message }}
  • Profile picture of the author scriptkid
    @Michael71 : thanks for those links.. its very useful..


    I included this in ma .htaccess
    RewriteEngine On
    RewriteRule ^([^/]*)\.html$ /tests/check2.php?name=$1 [L]

    its not working.. i dint go wrong anywhere.. i have been trying it since 3 hrs..
    {{ DiscussionBoard.errors[5047493].message }}
  • Profile picture of the author scriptkid
    and btw.. rewrite module is loaded in the apache config on ma server side.. i have my wordpress blog running on the same host which uses some mod_rewrite rules..

    i am sure there is no problem on ma server side..
    {{ DiscussionBoard.errors[5047532].message }}
  • Profile picture of the author SeeSharp
    I don't know your current setup but that should work:

    RewriteEngine On
    RewriteRule site\.com\/tests\/(.*?)\.html /tests/check2.php?name=$1
    {{ DiscussionBoard.errors[5048304].message }}
  • Profile picture of the author johnyj
    Michael link was very much useful...thanks
    {{ DiscussionBoard.errors[5048313].message }}
  • Profile picture of the author academysigma
    Try the following. It does 3 commonly required things
    1. Clean URL
    2. Removes the www prefix if necessary
    3. Parses html and htm as PHP so you can have PHP code on html pages.

    Unfortunately I can't post links and didn't want to mess up the code so you can view and edit at:
    academysigma-dot-com-slash-htaccess

    Hope it helps.
    {{ DiscussionBoard.errors[5053733].message }}

Trending Topics