Wordpress friendly album/? album_id={id} URL for album/{id}

Asked

Viewed 133 times

0

I developed a site in Wordpress and to make it faster, I decided to use the module wp Fastest cache

However, the site has an image gallery that matters from Picasa through another module Picasa Album Viewer

The Picasa module loads a URL like this:

http://meusite.com.br/album/?album_id=12345

This format above causes the site not to be processed by the module wp Fastest cache slowing down this page.

What I want to know: Is there a possibility to make the URL look like this:

http://meusite.com.br/album/12345

How would that look in the .htaccess?

Currently the .htaccess is like this:

# BEGIN WpFastestCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
AddDefaultCharset UTF-8
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteCond %{REQUEST_URI} !^/wp-login.php
RewriteCond %{REQUEST_URI} !^/wp-admin
RewriteCond %{REQUEST_URI} !^/wp-content
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*(iphone|sony|symbos|nokia|samsung|mobile|epoc|ericsson|panasonic|philips|sanyo|sharp|sie-|portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc|android|blackberry|playbook|ipad|ipod|iemobile|palmos|webos|googlebot-mobile|bb10|xoom|p160u|nexus).*$ [NC]
RewriteCond /var/www/clients/client0/web99/web/wp-content/cache/all/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
</IfModule>
# END WpFastestCache
# BEGIN LBCWpFastestCache
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|x-html|css|xml|js|woff|ttf|svg|eot)(\.gz)?$">
<IfModule mod_expires.so>
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
</IfModule>
<IfModule mod_headers.c>
Header set Expires "max-age=2592000, public"
Header unset ETag
</IfModule>
FileETag None
</FilesMatch>
# END LBCWpFastestCache
# BEGIN GzipWpFastestCache
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
# END GzipWpFastestCache
# 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

In the archive functions.php I have it:

function add_query_var( $qvars ) {
     $qvars[] = 'album_id';     
     return $qvars;
}

add_filter('query_vars', 'add_query_var');              // Add a new URL parameter

// Retrieve and display the URL parameter
function output_album_id() {

     global $wp_query;

     if( isset( $wp_query->query_vars['album_id'] ) ) {
          return $wp_query->query_vars['album_id'];
     }
}
  • It may be that a endpoint can help, check out this answer. It would also be the case to confirm how the Picasa albuns module does the URL processing.

  • If I’m not mistaken, there are several similar questions on the site already.

  • Hello Bacco, I did several searches before asking and unfortunately I have not solved my problem.

  • Wordpress does not have a native friendly url function?

1 answer

2


See if this can help you:

RewriteRule ^album/(.*)$ album/index.php?album_id=$1 [L]

Probably solves your problem

Browser other questions tagged

You are not signed in. Login or sign up in order to post.