WordPress.org

Forums

custom htaccess for apge (4 posts)

  1. joskoomen
    Member
    Posted 1 year ago #

    I've created a page with the slug /doodle/ in this page i would like to show images

    mydomain.com/doodle?img=image_id works fine. But i would like to create a nice url for it like /doodle/image_id/ i'm not a htaccess rockstar and get a internal server error or a page not found. Can someone give me a hand on how to add this to my htaccess file?

    this is my htaccess file

    # 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]
    RewriteRule ^/doodle/$ ?img=$1 [NC]
    </IfModule>
    # END WordPress
  2. peter achutha
    Member
    Posted 1 year ago #

    You could, in your control panel, go to Settings >> Permalinks and in the section Common Settings select the radio button to Post name. That way you do not have to make any changes to your .htaccess file. Use your original .htaccess file.

  3. joskoomen
    Member
    Posted 1 year ago #

    Hi Peter,

    Thanks for reply but it's not what I mean.
    I have one page with a slug called doodle.

    I want to rewrite /doodle/?img=imagekey to /doodle/imagekey/

    I can't set that at the permalink settings right?

  4. peter achutha
    Member
    Posted 1 year ago #

    I assume your WP blog is installed in /doodle/ sub-directory. It should work as I tested it on my experimental / testing blog and found that the slug replaces the title of the post when your permalinks (Settings >> Permalinks ) is set to 'post name'. I did not try for other types of permalinks.

    One more thing, you may find that you may not need to use slugs if your permalinks are set to 'post name'.

    ... sorry I may have not answered your question. How does or what is imagekey?

Topic Closed

This topic has been closed to new replies.

About this Topic