• jbaldo

    (@jbaldo)


    Hi,

    I’m trying to figure out the mod_rewrite syntax. I don’t want to do anything complex at all. I’m just looking to make a static rule that says:

    www.example.com/foo

    should go to some dynamic like:

    www.example.com/?pageid=4

    I can accomplish this with a simple Redirect statement, but I want the url to remain /foo in the address bar, not show the static page.

    I’ve looked at the apache documentation and couldn’t quite pin down the syntax for something so simple. Could anyone lend a hand with an example? I’d appreciate it.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter jbaldo

    (@jbaldo)

    I should add:

    One of the things I’m confused about is whether or not it is necessary to start a pattern statement with ^ and end it with $

    I’m seeing examples which do this and others that do not.

    Kalessin

    (@kalessin)

    I don’t think this is something you need for WordPress, which handles this internally. But anyway, you might find the Regular Expression Cheat Sheet at ILoveJackDaniels helpful.

    Thread Starter jbaldo

    (@jbaldo)

    WordPress very nicely generates the code necessary for permalinks, which essentially turn static urls into dynamic ones. It cannot, however, create a rule that will just handle one case like I described above.

    I’ve gotten it to work where

    https://www.mysite.com/foo rewrites as https://www.google.com using:

    RewriteRule ^foo$ https://www.google.com/ [L]

    but I can’t make it rewrite to one of my own pages.

    Chris_K

    (@handysolo)

    Boy, I’m confused.

    Why are you doing this — wouldn’t it make more sense to visit Options -> Permalinks and change them from default?

    Thread Starter jbaldo

    (@jbaldo)

    I did, but I still don’t like some of the permalinks for static pages. I want to abbreviate some of them.

    For instance:
    /mailing-list to /list or something like that.

    Why does everyone insist on telling me I don’t know what I want instead of just helping me with my question?

    whooami

    (@whooami)

    Maybe because you are attempting to accomplish this is a most unusual way?

    If you dont like the current page slug, why not just change the slug?

    Chris_K

    (@handysolo)

    Well, until your last point I could argue you hadn’t clearly explained what you wanted ??

    As whoo mentioned, just edit the page slug from the page editor.

    Kalessin

    (@kalessin)

    Why does everyone insist on telling me I don’t know what I want instead of just helping me with my question?

    Because you didn’t explain why you wanted to do it.

    As none of your respondents are .htaccess experts, they naturally looked for other ways to help that were within their areas of expertise, rather than just ignoring your post and waiting for someone more knowledgeable to (maybe) come along.

    Considering you’re here asking for help, your last post came across as a little rude. Might have just been the way I read it.

    Anyway: try editing the page slug ??

    whooami

    (@whooami)

    actually, I am a a wannabe .htaccess expert, I even did a little of my own fiddling until i understood the “why”.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘mod_rewrite syntax’ is closed to new replies.