Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post 
Post CUSTOMIZATION - About .htaccess Paths 
 
Today I've benn looking inside the .htaccess just to try to learn how mod_rewrite works, and I found something:

I found these lines:

Code: [Download] [Hide]
  1. # STRICT CONDITION  
  2. #RewriteCond %{QUERY_STRING} ^.*(phpbb_root_path|album_root_path|module_root_path|mx_root_path|upi2db_file_path).*$  
  3. # LESS STRICT CONDITION  
  4. RewriteCond %{QUERY_STRING} ^.*(phpbb_root_path=|album_root_path=|module_root_path=|mx_root_path=|upi2db_file_path=).*$ 


So I figured out That I should replace all those paths with the ones in my web, isn't it?

And how should I fill it? I mean... As that .htaccess is in the root of my forum, phpbb_root_path should be "/", or "home/ka-tet-corp.com/data/htdocs/portal2.0"?

And which is the path to module_root and mx_root?

Thanks and sorry for such a dumb question !!!
 




____________
Icy Phoenix Latest 2.0 (working pending)
Style: Aphrodite and MG_Themes
Site: Spanish Stephen King fan forum
Mods: Medal System Mod. BBAntispam 1.2. Several own BBcodes.
 
XusquiSend private messageVisit poster's website  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: About .htaccess paths! 
 
Hi Xusqui,

to find out how mod_rewrite works, please take a look into that forum http://forum.modrewrite.com/

maybe this can help you...

cya
 




____________

Play Games at GamesCampus!
 
KugeLSichASend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: About .htaccess paths! 
 
No, you don't replace anything here. The condition is looking for you *edit... not neccessarily you but a hacker* trying to parse to the variables phpbb_root_path, album_root_path, module_root_path, mx_root_path and upi2db_file_path, these are actual variables in XS, and somebody might be trying to write to the query string yousite.com/somepage.php?mx_root_path=www.nasty.peoples.website.ru/nastyfile.php
The Query string means whatever is between ? and =

The syntax of .htaccess is nothing like php, but a wierd mix of pearl regex syntax, and some c++/php style boloean. I still don't understand it fully... and have to regularly resort to http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

What MG has come up with here is nice and simple, yet completely failsafe (with one exception... if you don't have apache, or you do, but don't have mod rewrite!).
 



 
moreteavicarSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Respuesta: About .htaccess paths! 
 
Ok, Thnx moreteavicar!!!!

I'm an absolute dumb with .htaccess and mod_rewrite, so I didn't know what that line was for!!!

Thnx again!!
 




____________
Icy Phoenix Latest 2.0 (working pending)
Style: Aphrodite and MG_Themes
Site: Spanish Stephen King fan forum
Mods: Medal System Mod. BBAntispam 1.2. Several own BBcodes.
 
XusquiSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: About .htaccess paths! 
 
You're welcome
 



 
moreteavicarSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Respuesta: About .htaccess paths! 
 
BTW, KugeLSichA, thank you very much for such a link... It really helped me to get what I wanted to... Now I got the website the way I like!!!
 




____________
Icy Phoenix Latest 2.0 (working pending)
Style: Aphrodite and MG_Themes
Site: Spanish Stephen King fan forum
Mods: Medal System Mod. BBAntispam 1.2. Several own BBcodes.
 
XusquiSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Respuesta: About .htaccess paths! 
 
Xusqui wrote: [View Post]
BTW, KugeLSichA, thank you very much for such a link... It really helped me to get what I wanted to... Now I got the website the way I like!!!


you´re welcome!

nice to hear that you solved this
 




____________

Play Games at GamesCampus!
 
KugeLSichASend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: About .htaccess paths! 
 
Xusqui, try to post here what you have done, so someone else should take advantage of it.

I'll move this post to Docs...
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post 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:

Code: [Download] [Hide] [Select]
Options +FollowSymLinks

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

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


So I created the new line:

Code: [Download] [Hide]
  1. RewriteRule ^([a-zA-Z0-9]+).php$ /portal2.0/>RewriteRule ^([a-zA-Z0-9]+).php$ /portal2.0/$1.php [R=301,L] <.php [R=301,L] 


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




____________
Icy Phoenix Latest 2.0 (working pending)
Style: Aphrodite and MG_Themes
Site: Spanish Stephen King fan forum
Mods: Medal System Mod. BBAntispam 1.2. Several own BBcodes.
 
XusquiSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: About .htaccess paths! 
 
Great, that is just what I would have read.

I think this will help someone else.

Thank you.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML

HideSimilar Topics





 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events


  

 

  cron