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 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2012
    Posts
    40
    Thanks
    0
    Thanked 1 Time in 1 Post

    mod_rewrite custom script url to friendly url

    Hello,

    I have a script that I want to integrate with WordPress. I managed to get it working but I still got very ugly URLS.

    I'm testing this on a subdomain and my URLS are looking like this:

    http://banden.jvandongen.com/zomerba...t=ZO&band=1874

    And I want them to be like this:

    http://banden.jvandongen.com/zomerbanden/connexion/

    so ?merk=TY&cat=ZO gone from the URL and &band=1874 for connexion

    Is this possible with mod_rewrite?

    "zomerbanden" is a wordpress page and my permalink settings look like this:

    /%category%/%postname%/

    My WordPress .htaccess now looks like this:

    Code:
    # BEGIN Wordpress
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END Wordpress
    If this is possible with mod_rewrite can somebody help me with this?

    Thanks in advance

    Kind regards

  • #2
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    709
    Thanks
    20
    Thanked 84 Times in 84 Posts
    wordpress has its own rewrite function built in

    theres about 5 options

    on the left under Settings Click Permalinks

    change it to postname or do your own custom one
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  • #3
    New Coder
    Join Date
    Jun 2012
    Posts
    40
    Thanks
    0
    Thanked 1 Time in 1 Post
    I know... that part is working. otherwise "zomerbanden" would be "page_id=16" so I allready changed that...

    If read my question again I said I have a own script working within WordPress but the URLS are ugly...

    I know that WordPress has his own rewrite function but I know for sure you can add your own lines too... Only I dont know how to make it work properly...

    Anybody can help me with this?

  • #4
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    709
    Thanks
    20
    Thanked 84 Times in 84 Posts
    something like

    RewriteRule ^zomerbanden/connexion$ /zomerbanden/?merk=TY&cat=ZO&band=1874 [L]
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  • #5
    New Coder
    Join Date
    Jun 2012
    Posts
    40
    Thanks
    0
    Thanked 1 Time in 1 Post
    Something like that...

    But When I add that rule to my .htaccess and I enter the new url in my browser I get redirected to "Page Not Found"

    I tried many things but nothing is working... Also tried this:

    RewriteRule ^/zomerbanden/([a-z]+)/([a-z]+)/([0-9]+)$ /zomerbanden/?merk=$1&cat=$2&band=$3 [L,NC]

    So when I enter http://banden.jvandongen.com/zomerbanden/TY/ZO/1874 it should work but then I got redirected to this page:

    http://banden.jvandongen.com/zomerbanden/1874/

    Anybody has ideas why this is happening?


  •  

    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
    •