PDA

View Full Version : write a rule


xony
07-28-2014, 07:58 AM
How to write a rule to redirect url the first to the second? thanks for the help.

http://www.foro3d.com/post/722216-Critica-Americana-Planet-51

http://www.foro3d.com/threads/81976-Critica-Americana-Planet-51?p=722216&viewfull=1#post722216

cellarius
07-28-2014, 09:09 AM
It would have been a good thing to put the urls inside code tags, so they don't get linked and shortened.

http://www.foro3d.com/post/722216-Critica-Americana-Planet-51
http://www.foro3d.com/threads/81976-Critica-Americana-Planet-51?p=722216&viewfull=1#post722216

If a redirect via htaccess is what you're looking for, that's not possible since the threadid (81976) is not present in the originating URL.

xony
07-28-2014, 09:40 AM
Thanks for your help, greetings friend.

Rafa-el
07-29-2014, 10:21 PM
It would have been a good thing to put the urls inside code tags, so they don't get linked and shortened.

http://www.foro3d.com/post/722216-Critica-Americana-Planet-51
http://www.foro3d.com/threads/81976-Critica-Americana-Planet-51?p=722216&viewfull=1#post722216

If a redirect via htaccess is what you're looking for, that's not possible since the threadid (81976) is not present in the originating URL.

Sorry to contradict. But that doens't matter since he's redirecting to the post URL not the thread.

@OP, Try to play around with this:


RewriteRule /post/([0-9]+)-([\d]+)\ /showthread.php?=$1#post$1 [NC,L]


If it doesn't work let me know, it's also possible to make a rewrite but you get the basics with that one.

Rafael

cellarius
07-30-2014, 06:06 AM
I know that it is possible to access a post in this way, but that is not the URL he wants to redirect to, is it? He asked for a redirection to a specific form of URL.

xony
07-30-2014, 06:51 PM
Thanks Rafael, unfortunately does not work.

I want to redirect all post / in general, which was to put an example, there are actually many more.

If you think there may be a rewrite solution, please help me, I am willing to compensate you.


This is my htaccess:


Options +FollowSymLinks
Options +Indexes
# AddDefaultCharset utf-8

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.foro3d\.com$
RewriteRule (.*) http://www.foro3d.com/$1 [R=301,L]

RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^blogs/.* blog.php [QSA]
RewriteRule ^entries/.* entry.php [QSA]

# Forum
RewriteRule ^threads/.* showthread.php [QSA]
RewriteRule ^forums/.* forumdisplay.php [QSA]
RewriteRule ^members/.* member.php [QSA]


RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

# para redirigir url antiguas----------------
RewriteEngine on
RewriteRule f[\d]+/.+-([\d]+)-([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
RewriteRule f[\d]+/.+-([\d]+).html showthread.php?t=$1 [NC,L]
RewriteRule f([\d]+)/i([\d]+).html forumdisplay.php?f=$1&page=$2 [NC,L]
RewriteRule f([\d]+)/ forumdisplay.php?f=$1 [NC,L]
# fin redirigir url antiguas------------------------------

# MVC
RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]


# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0

# Set up caching on media files for 1 year (forever?)
<filesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A29030400
Header append Cache-Control "public"
</filesMatch>

# Set up caching on media files for 1 week
<filesMatch "\.(gif|jpg|jpeg|png|swf)$">
ExpiresDefault A604800
Header append Cache-Control "public"
</filesMatch>

# Set up 2 Hour caching on commonly updated files
<filesMatch "\.(xml|txt|html|js|css)$">
ExpiresDefault A604800
Header append Cache-Control "proxy-revalidate"
</filesMatch>

# Force no caching for dynamic files
<filesMatch "\.(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</filesMatch>

<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>

<FilesMatch "\.(ico|gif|jpg|png|flv|pdf|mp3|js|css|xml)$">
Header set Cache-Control "max-age=2592000"
Header always unset Set-Cookie
Header unset ETag
FileETag None
</FilesMatch>

<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>

redirect 301 /f121 http://www.foro3d.com/forums/121-Maya/
redirect 301 /f111 http://www.foro3d.com/forums/111-Blender/
redirect 301 /f36 http://www.foro3d.com/forums/36-Mercadillo-del-Foro
redirect 301 /f254 http://www.foro3d.com/forums/254-Blueprints
redirect 301 /f114 http://www.foro3d.com/forums/114-Acepta-el-Reto
redirect 301 /f143 http://www.foro3d.com/forums/143-Rhino
redirect 301 /f125 http://www.foro3d.com/forums/125-Adobe-Premiere
redirect 301 /f112 http://www.foro3d.com/forums/112-3DStudio-Max
redirect 301 /f135 http://www.foro3d.com/forums/135-ZBrush
redirect 301 /f152 http://www.foro3d.com/forums/152-Cinema-4D
redirect 301 /portafolio/ http://www.foro3d.com/blog.php?/
redirect 301 /etiquetas/ http://www.foro3d.com/tags/
redirect 301 /f150 http://www.foro3d.com/forums/150-After-Effects
redirect 301 /f153 http://www.foro3d.com/forums/153-InKscape