Wordpress friendly URL in album /? album_id = {id} for album / {id} [duplicate]

0

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

However, the site has a gallery of images that you import from Picasa through another 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 wp fastest cache module, leaving this page slower.

What I want to know: We have the possibility to make the URL look like this:

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

How would that look in .htaccess ?

.htaccess is now 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 functions.php file I have this:

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'];
     }
}
    
asked by anonymous 31.03.2014 / 17:05

1 answer

2

See if this might help you:

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

Probably solves your problem

    
15.05.2014 / 22:33