WordPress.org

Ready to get started?Download WordPress

Forums

URL Rewrite for Query in URL (8 posts)

  1. mjulson
    Member
    Posted 6 years ago #

    I created two WP pages, one parent to the other. And I'm passing a variable from pageone to pagetwo. What do I need to do to rewrite the url so the querystring is extended to another folder?

    So I have

    /pageone/pagetwo/?getCat=Flowers

    How can I make it:

    /pageone/pagetwo/flowers/

    I'm using WordPress 2.3.1

    I assume I need to add a rewrite rule to my htaccess. Can someone help me with the rule?

    I remember reading something about 2.3.1 doing something to rewrites, does it affect this?

  2. mjulson
    Member
    Posted 6 years ago #

    I thought it might be helpful to list my htaccess file as it is today.

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

    Anyone able to help on the rule for me?

    On another note, I saw a comment from another forum that it's bad to have it duplicated as it is above. IS that correct?

  3. c77m
    Member
    Posted 6 years ago #

    mjulson, I don't know what the actual effect of having everything duplicated in your .htaccess would be, but it sure isn't necessary.

    If you figure this out, please let the rest of us know. I've been struggling with this myself for some time. Whether it is within the .htaccess rewrite rules that it needs to change or if there is something that could be done with a plugin or hack, I haven't been able to figure out. But I sure could use the ability to attach variables to the end of permalinks.

  4. mjulson
    Member
    Posted 6 years ago #

    Thanks, I guess I'll remove the upper section.

    Anyone have any suggestions on other resources I might use to figure out how to create the rules? I tried a couple other places and got flamed for WP's use of mod rewrite. Is there another forum that's friedly to WP folks?

  5. mjulson
    Member
    Posted 6 years ago #

    If no one can help figure this out, does anyone know of tutorials beyond the basic ones already listed in the docs? I've gone through the basic docs and read a lot of non-wordpress related docs but I can't figure out the rules I need. I think my problem is that it's conflicting with what WordPress is already doing.

    I'll offer up a shaker and martini glasses to someone that helps me sucessfully get this working.(company swag) :)

  6. Cailean
    Member
    Posted 6 years ago #

    The problem is that WP no longer uses .htaccess and mod_rewrite for permalinks - everything is rewritten to index.php, and the code examines the URL and finds the appropriate content.

    You may need a plugin to get what you want.

  7. ryrobes
    Member
    Posted 6 years ago #

    Bump.

    Using htaccess rules or not, has anyone figured out how this can be done? I've been beating my head into the wall for a week not trying to do the same thing. :(

  8. jimdo
    Member
    Posted 6 years ago #

    Ever figure this one out?

    I'd like to be able to re-write a 'nice' URL to pass parameters to a common wordpress page. For example, I'd like to make the URL:

    /destination/phoenix/arizona/

    re-write internally to:

    /destination?city=phoenix&state=arizona

    so that the page 'destination' can work with the parameters.

    Anyone?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.