https://www.icyphoenix.com/viewtopic.php?f=4&t=392&p=3581#p3581
-----------------------------------
Xusqui
Mon 02 Oct, 2006 00:42

Respuesta: About .htaccess paths!
-----------------------------------
Actually... I didn't change anything meaning I didn't change the code posted in the first topic... But...

1.- I had my site inside /portal/
2.- I moved my site inside /porta2.0/
3.- I wanted that every request to /portal/xxxx.xxx was redirected to /portal2.0/xxxx.xxx

so, inside /portal/ I created a .htaccess with the following code:

[codeblock]Options +FollowSymLinks

RewriteEngine on 
RewriteRule ^([a-zA-Z0-9]+).php$ /portal2.0/$1.php [R=301,L]

RewriteRule [.]*-vf([0-9]*) /portal2.0/viewforum.php?%{QUERY_STRING}&f=$1 [R=301,L]
RewriteRule [.]*-vp([0-9]*) /portal2.0/viewtopic.php?%{QUERY_STRING}&p=$1 [R=301,L]
RewriteRule [.]*-vt([0-9]*) /portal2.0/viewtopic.php?%{QUERY_STRING}&t=$1 [R=301,L]
RewriteRule [.]*-vf([0-9]*) /portal2.0/viewforum.php?%{QUERY_STRING}&amp;f=$1 [R=301,L]
RewriteRule [.]*-vc([0-9]*) /portal2.0/forum.php?%{QUERY_STRING}&c=$1 [R=301,L]
RewriteRule [.]*-vc([0-9]*) /portal2.0/forum.php?%{QUERY_STRING}&c=$1 [R=301,L]
RewriteRule [.]*-ac([0-9]*) /portal2.0/album_cat.php?%{QUERY_STRING}&cat_id=$1 [R=301,L]
RewriteRule [.]*-at([0-9]*) /portal2.0/album_thumbnail.php?%{QUERY_STRING}&pic_id=$1 [R=301,L]
RewriteRule [.]*-apic([0-9]*) /portal2.0/album_pic.php?%{QUERY_STRING}&pic_id=$1 [R=301,L]
RewriteRule [.]*-apm([0-9]*) /portal2.0/album_picm.php?%{QUERY_STRING}&pic_id=$1 [R=301,L]
RewriteRule [.]*-full-asp([0-9]*) /portal2.0/album_showpage.php?full=&pic_id=$1 [R=301,L]
RewriteRule [.]*-asp([0-9]*) /portal2.0/album_showpage.php?%{QUERY_STRING}&pic_id=$1 [R=301,L]
RewriteRule [.]*-aper([0-9]*) /portal2.0/album_personal.php?%{QUERY_STRING}&user_id=$1 [R=301,L]
RewriteRule [.]*-dc([0-9]*) /portal2.0/dload.php?%{QUERY_STRING}action=category&cat_id=$1 [R=301,L]
RewriteRule [.]*-df([0-9]*) /portal2.0/dload.php?%{QUERY_STRING}action=file&file_id=$1 [R=301,L]
RewriteRule [.]*-kbc([0-9]*) /portal2.0/kb.php?%{QUERY_STRING}mode=cat&cat=$1 [R=301,L]
RewriteRule [.]*-kba([0-9]*) /portal2.0/kb.php?%{QUERY_STRING}mode=article&k=$1 [R=301,L]
RewriteRule [.]*-kbsmp /portal2.0/kb.php?mode=stats&stats=mostpopular [R=301,L]
RewriteRule [.]*-kbstr /portal2.0/kb.php?mode=stats&stats=toprated [R=301,L]
RewriteRule [.]*-kbsl /portal2.0/kb.php?mode=stats&stats=latest [R=301,L]
RewriteRule [.]*-pbc([0-9]*) /portal2.0/kb.php?%{QUERY_STRING}mode=cat&cat=$1 [R=301,L]
RewriteRule [.]*-pa([0-9]*) /portal2.0/kb.php?%{QUERY_STRING}mode=article&k=$1 [R=301,L]
RewriteRule [.]*-psmp /portal2.0/kb.php?mode=stats&stats=mostpopular [R=301,L]
RewriteRule [.]*-pstr /portal2.0/kb.php?mode=stats&stats=toprated [R=301,L]
RewriteRule [.]*-pbsl /portal2.0/kb.php?mode=stats&stats=latest [R=301,L]

# SANTY
RewriteCond %{HTTP_REFERER} ^.*$
RewriteRule ^.*%27.*$ http://127.0.0.1/ [redirect,last]
RewriteRule ^.*%25.*$ http://127.0.0.1/ [redirect,last]
RewriteRule ^.*rush=.*$ http://127.0.0.1/ [redirect,last]
RewriteRule ^.*echr.*$ http://127.0.0.1/ [redirect,last]
RewriteRule ^.*esystem.*$ http://127.0.0.1/ [redirect,last]
RewriteRule ^.*wget.*$ http://127.0.0.1/ [redirect,last]
RewriteCond %{HTTP_COOKIE}% s:(.*):%22test1%22%3b
RewriteRule ^.*$ http://127.0.0.1/ [R,L]
# Prevent perl user agent (most often used by santy)
RewriteCond %{HTTP_USER_AGENT} ^lwp.* [NC]
RewriteRule ^.*$ http://127.0.0.1/ [R,L]
RewriteCond %{HTTP_REFERER} ^.*$

# This ruleset is to "stop" stupid attempts to use MS IIS expolits on us
# NIMDA
RewriteCond %{REQUEST_URI} /(admin¦cmd¦httpodbc¦nsiislog¦root¦shell).(dll¦exe) [NC]
RewriteRule !(error.php|robots.txt) /error.php?mode=nimda [L,E=HTTP_USER_AGENT:NIMDA_EXPLOIT,T=application/x-httpd-cgi]
#RewriteRule .* - [F,L]

# CODERED
RewriteCond %{REQUEST_URI} /default.(ida¦idq)$ [NC,OR]
RewriteCond %{REQUEST_URI} /.*.printer$ [NC]
RewriteRule !(error.php|robots.txt) /error.php?mode=codered [L,E=HTTP_USER_AGENT:CODERED_EXPLOIT,T=application/x-httpd-cgi]
#RewriteRule .* - [F,L][/codeblock]

So I created the new line:

[code]RewriteRule ^([a-zA-Z0-9]+).php$ /portal2.0/$1.php [R=301,L][/code]

to redirect each request for .php file to portal2.0

And the other lines are the original rewrite mod used for XS to redirect them from /portal/ to /portal2.0/

That's is!!


