Foros del Web » Administración de Sistemas » Apache »

.htcaccess: redirecciones con subdominios sin páginas duplicadas

Estas en el tema de .htcaccess: redirecciones con subdominios sin páginas duplicadas en el foro de Apache en Foros del Web. Buenas, tengo el siguiente dominio: http://masquelabradores.com En el directorio raíz cualga una carpeta con un foro llamada foro-perros Sería así: http://masquelabradores.com/foro-perros He decidido crear un ...
  #1 (permalink)  
Antiguo 10/09/2014, 16:03
 
Fecha de Ingreso: julio-2013
Ubicación: Córdoba
Mensajes: 84
Antigüedad: 10 años, 8 meses
Puntos: 0
.htcaccess: redirecciones con subdominios sin páginas duplicadas

Buenas, tengo el siguiente dominio:

http://masquelabradores.com

En el directorio raíz cualga una carpeta con un foro llamada foro-perros

Sería así:

http://masquelabradores.com/foro-perros

He decidido crear un subdominio "foro-perros" para intentar mejorar un poco el posicionamiento del foro dejando la web así

Ahora viene el meollo, que no soy capaz de redireccionar todo sin que me queden páginas duplicadas.

Lo que quiero es que no haya ninguna página con "www", que desaparazcan los index.php y que todas las páginas (incluida la misma) que cuelgan de


http://masquelabradores.com/foro-perros/

pasen a colgar de:

De verdad que llevo un buen rato intentandolo y me veo incapaz , no es comodidad de que me hagais el trabajo, es que no sé... Al final consigo redireccionar pero se me quedan colgando algunas páginas con www. que no rediregen y me he vuelto loco.

Si quereis os dejo el htcacees, pero es que le he dado tantas vueltas que ya no sé ni lo que tengo...

Si alguien es capaz de ver fácilmente como se hace todo eso que me lo diga por favor...

Última edición por WebTech; 06/10/2014 a las 07:42
  #2 (permalink)  
Antiguo 10/09/2014, 17:31
 
Fecha de Ingreso: julio-2013
Ubicación: Córdoba
Mensajes: 84
Antigüedad: 10 años, 8 meses
Puntos: 0
Respuesta: .htcaccess: redirecciones con subdominios sin páginas duplicadas

Bueno, he conseguido algunos avances. He conseguido que me funcione todo lo que quería excepto hacer desaparecer las index.php e index.html

Os pongo el htcaccess (está al final lo que he modificado):

Código:
RewriteOptions inherit
#   BULLETPROOF .50.8 >>>>>>> SECURE .HTACCESS     

# If you edit the BULLETPROOF .50.8 >>>>>>> SECURE .HTACCESS text above
# you will see error messages on the BPS Security Status page
# BPS is reading the version number in the htaccess file to validate checks
# If you would like to change what is displayed above you
# will need to edit the BPS /includes/functions.php file to match your changes
# If you update your WordPress Permalinks the code between BEGIN WordPress and
# END WordPress is replaced by WP htaccess code.
# 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
# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
        AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_mime.c>
        # DEFLATE by extension
        AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
</IfModule>
# END W3TC Browser Cache
# BEGIN W3TC CDN
<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
# END W3TC CDN
# BEGIN W3TC Page Cache core
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteRule .* - [E=W3TC_ENC:_gzip]
    RewriteCond %{HTTP_COOKIE} w3tc_preview [NC]
    RewriteRule .* - [E=W3TC_PREVIEW:_preview]
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{REQUEST_URI} \/$
    RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
    RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f
    RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
</IfModule>
# END W3TC Page Cache core
# 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
# This removes all of the BPS security code and replaces it with just the default WP htaccess code
# To restore this file use BPS Restore or activate BulletProof Mode for your Root folder again.

# 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

# BLOCK HOTLINKING TO IMAGES
# To Test that your Hotlinking protection is working visit http://altlab.com/htaccess_tutorial.html
#RewriteEngine On
#RewriteCond %{HTTP_REFERER} !^https?://(www\.)?add-your-domain-here\.com [NC]
#RewriteCond %{HTTP_REFERER} !^$
#RewriteRule .*\.(jpeg|jpg|gif|bmp|png)$ - [F]

# FORBID COMMENT SPAMMERS ACCESS TO YOUR wp-comments-post.php FILE
# This is a better approach to blocking Comment Spammers so that you do not 
# accidentally block good traffic to your website. You can add additional
# Comment Spammer IP addresses on a case by case basis below.
# Searchable Database of known Comment Spammers http://www.stopforumspam.com/

<FilesMatch "^(wp-comments-post\.php)">
Order Allow,Deny
Deny from 46.119.35.
Deny from 46.119.45.
Deny from 91.236.74.
Deny from 93.182.147.
Deny from 93.182.187.
Deny from 94.27.72.
Deny from 94.27.75.
Deny from 94.27.76.
Deny from 193.105.210.
Deny from 195.43.128.
Deny from 198.144.105.
Deny from 199.15.234.
Allow from all
</FilesMatch>

# BLOCK MORE BAD BOTS RIPPERS AND OFFLINE BROWSERS
# If you would like to block more bad bots you can get a blacklist from
# http://perishablepress.com/press/2007/06/28/ultimate-htaccess-blacklist/
# You should monitor your site very closely for at least a week if you add a bad bots list
# to see if any website traffic problems or other problems occur.
# Copy and paste your bad bots user agent code list directly below.

RewriteCond %{HTTP_HOST} ^masquelabradores\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.masquelabradores\.com$
RewriteRule ^foro\-perros\/?(.*)$ "http\:\/\/foro\-perros\.masquelabradores\.com\/$1" [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/

RewriteRule ^(([^/]+/)*)index\.html$ http://www.foro-perros.masquelabradores.com/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/

RewriteRule ^(([^/]+/)*)index\.php$ http://www.foro-perros.masquelabradores.com/$1 [R=301,L]


<IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} ^www.foro-perros.masquelabradores.com [NC]
RewriteRule ^(.*)$ http://foro-perros.masquelabradores.com/$1 [R=301,L]
</IfModule>

Etiquetas: dominio, duplicadas, páginas, php, redireccionar, subdominios, todas
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:49.