.htaccess / URL rewrite issue with a script

 
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting
View previous topic :: View next topic  
Author Message
Kent
-


Joined: 12 Jan 2003
Posts: 137

PostPosted: Thu Jan 04, 2007 10:59 pm    Post subject: .htaccess / URL rewrite issue with a script Reply with quote

Aprelium, I want to run a certain script on my server here at home...
BUT they wrote their script to rely on apache's URL rewritting..

so now I need to translate the .htaccess commands to
work with abyss..


can you help me translate this?



<IfModule !mod_rewrite.c>
# ugly ugly hack to detect missing mod_rewrite
# RedirectMatch must be to an absolute destination, so forces 500 error...
ErrorDocument 500 "error: Apache does not have mod_rewrite loaded. Please check your apache setup."
RedirectMatch 302 .* index.php
</IfModule>

<Files "htaccess-dist">
order allow,deny
deny from all
</Files>

Options +FollowSymLinks

# PHP defaults to allowing file uploads of max 2MB, below is example option for 5MB.
# NB: Adjusting value may not work, depending on other configured php and apache limits
#php_value upload_max_filesize 5242880

# Elgg can be more of a RAM lover than PHP's default of 8 meg. E.g. 16 meg:
#php_value memory_limit 16777216

# Not really necessary, just to be clean
#php_flag short_open_tag off
# Forgot that anyone might still have this turned on
#php_flag register_globals off

<IfModule mod_rewrite.c>

RewriteEngine on



RewriteRule ^([0-9\-]+)\.css$ _templates/css.php?template=$1

RewriteRule ^(.+)\/rssstyles.xsl$ _rss/styles.php?rssurl=$1&url=$1

RewriteRule ^([A-Za-z0-9]+)\/dashboard(\/)?$ mod/adash/index.php?user=$1

RewriteRule ^([A-Za-z0-9]+)(\/)?$ profile/index.php?profile_name=$1
RewriteRule ^([A-Za-z0-9]+)\/profile(\/)?$ profile/index.php?profile_name=$1
RewriteRule ^([A-Za-z0-9]+)\/tags(\/)?$ search/personaltags.php?profile_name=$1
RewriteRule ^(([A-Za-z0-9])[A-Za-z0-9]+)\/rss\/?$ _rss/static.php?username=$1&userref=$2&type=profile
RewriteRule ^([A-Za-z0-9]+)\/rss\/(.+)\/?$ profile/rss2.php?profile_name=$1&tag=$2

RewriteRule ^([A-Za-z0-9]+)\/newsclient\/?$ _rss/subscriptions.php?profile_name=$1
RewriteRule ^([A-Za-z0-9]+)\/newsclient\/all\/?$ _rss/index.php?profile_name=$1
RewriteRule ^([A-Za-z0-9]+)\/newsclient\/all\/skip=([0-9]+)$ _rss/index.php?profile_name=$1&feed_offset=$2

RewriteRule ^([A-Za-z0-9]+)\/feeds\/?$ _rss/subscriptions.php?profile_name=$1
RewriteRule ^([A-Za-z0-9]+)\/feeds\/all\/?$ _rss/index.php?profile_name=$1
RewriteRule ^([A-Za-z0-9]+)\/feeds\/all\/skip=([0-9]+)$ _rss/index.php?profile_name=$1&feed_offset=$2

RewriteRule ^([A-Za-z0-9]+)\/weblog\/?$ _weblog/index.php?weblog_name=$1
ReWriteRule ^([A-Za-z0-9]+)\/weblog\/skip=([0-9]+)$ _weblog/index.php?weblog_name=$1&weblog_offset=$2
RewriteRule ^([A-Za-z0-9]+)\/weblog\/category\/([^\/]+)\/?$ _weblog/index.php?weblog_name=$1&filter=$2
ReWriteRule ^([A-Za-z0-9]+)\/weblog\/category\/([^\/]+)\/skip=([0-9]+)$ _weblog/index.php?weblog_name=$1&filter=$2&weblog_offset=$3
RewriteRule ^([A-Za-z0-9]+)\/weblog\/archive\/?$ _weblog/archive.php?weblog_name=$1
RewriteRule ^([A-Za-z0-9]+)\/weblog\/archive\/([0-9]+)\/([0-9]+)\/?$ _weblog/archive_month.php?weblog_name=$1&year=$2&month=$3
RewriteRule ^([A-Za-z0-9]+)\/weblog\/friends\/?$ _weblog/friends.php?weblog_name=$1
ReWriteRule ^([A-Za-z0-9]+)\/weblog\/friends\/skip=([0-9]+)$ _weblog/friends.php?weblog_name=$1&weblog_offset=$2
RewriteRule ^([A-Za-z0-9]+)\/weblog\/interesting\/?$ _weblog/interesting.php?weblog_name=$1
ReWriteRule ^([A-Za-z0-9]+)\/weblog\/interesting\/skip=([0-9]+)$ _weblog/interesting.php?weblog_name=$1&weblog_offset=$2
RewriteRule ^(([A-Za-z0-9])[A-Za-z0-9]+)\/weblog\/rss\/?$ _rss/static.php?username=$1&userref=$2&type=weblog
RewriteRule ^([A-Za-z0-9]+)\/weblog\/rss\/(.+)\/?$ _weblog/rss2.php?weblog_name=$1&tag=$2&modifier=is
RewriteRule ^([A-Za-z0-9]+)\/weblog\/rssnot\/(.+)\/?$ _weblog/rss2.php?weblog_name=$1&tag=$2&modifier=not
RewriteRule ^[A-Za-z0-9]+\/weblog\/([0-9]+)\.html$ _weblog/view_post.php?post=$1
RewriteRule ^[A-Za-z0-9]+\/weblog\/([0-9]+)\.html.([0-9]+)$ _weblog/view_post.php?post=$1&commentpage=$2

RewriteRule ^tag\/(.+)\/?$ search/all.php?tag=$1
RewriteRule ^rsstag\/(.+)\/?$ search/rss.php?tag=$1
RewriteRule ^tag\/(.+)/ecl\/?$ search/ecl.php?tag=$1

RewriteRule ^([A-Za-z0-9]+)\/friends\/?$ _friends/index.php?friends_name=$1
RewriteRule ^([A-Za-z0-9]+)\/foaf\/?$ _friends/foaf.php?friends_name=$1

RewriteRule ^([A-Za-z0-9]+)\/communities\/?$ _communities/index.php?friends_name=$1
RewriteRule ^community\/([0-9]+)\/?$ _communities/community.php?community_id=$1

RewriteRule ^([A-Za-z0-9]+)\/files\/?$ _files/index.php?files_name=$1
RewriteRule ^([A-Za-z0-9]+)\/files\/([0-9]+)\/?$ _files/index.php?files_name=$1&folder=$2
RewriteRule ^([A-Za-z0-9]+)\/files\/([0-9\-]+)\/([0-9]+)\/(.+)$ _files/download.php?files_name=$1&folder=$2&filename=$4&id=$3
RewriteRule ^(([A-Za-z0-9])[A-Za-z0-9]+)\/files\/rss\/?$ _rss/static.php?username=$1&userref=$2&type=files
RewriteRule ^([A-Za-z0-9]+)\/files\/rss\/(.+)\/?$ _files/rss2.php?files_name=$1&tag=$2

RewriteRule ^_icon\/user/([-0-9]+)$ _icons/icon.php?id=$1
RewriteRule ^_icon\/user/([-0-9]+)\/([A-Za-z])\/([0-9]+)$ _icons/icon.php?id=$1&constraint1=$2&size1=$3
RewriteRule ^_icon\/user/([-0-9]+)\/([A-Za-z])\/([0-9]+)\/([A-Za-z])\/([0-9]+)$ _icons/icon.php?id=$1&constraint1=$2&size1=$3&constraint2=$4&size2=$5
RewriteRule ^_icon\/file/([-0-9]+)$ _files/icon.php?id=$1

RewriteRule xml-rpc.php _rpc/RPC2.php
RewriteRule mt/mt-xmlrpc.cgi _rpc/RPC2.php

</IfModule>
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Thu Jan 04, 2007 11:57 pm    Post subject: Reply with quote

Have a look at this:
http://www.aprelium.com/forum/viewtopic.php?t=10033
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Jan 05, 2007 12:42 pm    Post subject: Reply with quote

Kent,

The RewriteRules are what you'll have to "translate" (into URL rewriting rules on Abyss Web Server) as explained in the article cited by TrustAbyss.

If you have any problem, please let us know.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Kent
-


Joined: 12 Jan 2003
Posts: 137

PostPosted: Sun Jan 07, 2007 2:06 am    Post subject: :( Reply with quote

To be quite honest I dont understand any of what I read in the referenced thread... I need as much help as you can give
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sun Jan 07, 2007 2:48 am    Post subject: Reply with quote

What script are you installing? I can test it if you provide us with a link to the
script's website. I will post instructions after.
Back to top View user's profile Send private message Visit poster's website
Kent
-


Joined: 12 Jan 2003
Posts: 137

PostPosted: Sun Jan 07, 2007 2:56 am    Post subject: Elgg Reply with quote

it's called Elgg, its an open source social networking script VERY COOL (you can make your own myspace site)

http://elgg.org -

any help you can give me on getting the url rewritting will be very aprecciated :)
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sun Jan 07, 2007 2:59 pm    Post subject: Re: Elgg Reply with quote

Kent,

If the script is put inside /elgg for example (which means, if that .htaccess file is accessible using http://yoursite/elgg/.htaccess), each line starting with RewriteRule should be translated in a URL rewriting as follows:

For example, translating:

Code:
RewriteRule ^([0-9\-]+)\.css$ _templates/css.php?template=$1


should be done by creating a new URL rewriting rule which:
* virtual path regular expression is ^/elgg/([0-9\-]+)\.css$
* Redirect to is set to /elgg/_templates/css.php?template=$1

Note that we've added /elgg/ is both the "virtual path regular expression" and the "redirect to" field.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Kent
-


Joined: 12 Jan 2003
Posts: 137

PostPosted: Sun Jan 07, 2007 7:09 pm    Post subject: Reply with quote

well I thought I understood what you were telling me....lol I tried adding things in the way I understood what you said and I still have the broken links for the parts of the script that use the RewriteRule ..
my elgg installation resides in the main root of htdocs.

heres what I did....

the following is a cliping from my conf file

Code:

   <rule>
                  <pattern>
                     ^([A-Za-z0-9]+)(\/)?$
                  </pattern>
                  <casesensitive>
                     yes
                  </casesensitive>
                  <subrequests>
                     yes
                  </subrequests>
                  <redirect>
                     0
                  </redirect>
                  <replacement>
                     profile/index.php?profile_name=$1
                  </replacement>
                  <qsa>
                     yes
                  </qsa>
                  <escape>
                     yes
                  </escape>
                  <nextaction>
                     0
                  </nextaction>
                  <status>
                     410
                  </status>
               </rule>
               <rule>
                  <pattern>
                     ^([A-Za-z0-9]+)\/profile(\/)?$
                  </pattern>
                  <casesensitive>
                     yes
                  </casesensitive>
                  <subrequests>
                     yes
                  </subrequests>
                  <redirect>
                     0
                  </redirect>
                  <replacement>
                     profile/index.php?profile_name=$1
                  </replacement>
                  <qsa>
                     yes
                  </qsa>
                  <escape>
                     yes
                  </escape>
                  <nextaction>
                     0
                  </nextaction>
                  <status>
                     410
                  </status>
               </rule>
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Jan 08, 2007 5:52 pm    Post subject: Reply with quote

Kent,

You still have not prefixed the regular expression and the redirect to with your script location.

For example: ^([A-Za-z0-9]+)(\/)?$ should be ^/SCRIPT_LOCATION/([A-Za-z0-9]+)(\/)?$ and //SCRIPT_LOCATION/profile/index.php?profile_name=$1
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Kent
-


Joined: 12 Jan 2003
Posts: 137

PostPosted: Mon Jan 08, 2007 7:00 pm    Post subject: Reply with quote

I figured it out :)

instead of this:

^/SCRIPT_LOCATION/([A-Za-z0-9]+)(\/)?$
/SCRIPT_LOCATION/profile/index.php?profile_name=$1

========================================

I did :

^\/([A-Za-z0-9]+)(\/)?$
/profile/index.php?profile_name=$1

and now it works.. \/ did the job
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group