User specified target path

Discuss practical ways rearrange URLs using mod_rewrite.

Postby axtg » Tue Mar 24, 2009 4:27 pm

Thanks. I guess I'll stick with this method.

The thing is that I need this file for an open source project (GPL). As you might know some people just don't read and I've had many people asking me why some parts of the script didn't work, which left me with telling them each and every time: because you haven't modified the .htaccess file correctly. With this one variable to change I guess they'll manage just a little better :).

Final code
Code: Select all
##
# Start modification
# Make sure the RewriteBase variable reflects your file structure
##

# For an installation under root (default)
# Example: www.mysite.com/index.php
RewriteBase /

# For an installation under /cms
# Example: www.mysite.com/cms/index.php
# RewriteBase /cms/

# For an installation under /test/compactcms
# Example: www.mysite.com/test/compactcms/index.php
# RewriteBase /test/compactcms/

##
# End modification
##

RewriteRule ^([^/]*)\.html$             index.php?page=$1 [L]
RewriteRule ^print/([^/]*)\.html$          afdrukken.php?page=$1 [L]
RewriteRule ^admin/includes/js/(.+\.js)$    admin/includes/combine.inc.php?type=javascript&files=$1 [L]
RewriteRule ^admin/img/styles/(.+\.css)$    admin/includes/combine.inc.php?type=css&files=$1 [L]


Thanks again and all the best!
Xander.
axtg
 
Posts: 6
Joined: Tue Mar 10, 2009 11:37 am

Postby richardk » Wed Mar 25, 2009 3:17 pm

Code: Select all
RewriteRule ^([^/]+)\.html$              index.php?page=$1                                       [L]
RewriteRule ^print/([^/]+)\.html$        afdrukken.php?page=$1                                   [L]
RewriteRule ^admin/includes/js/(.+\.js)$ admin/includes/combine.inc.php?type=javascript&files=$1 [L]
RewriteRule ^admin/img/styles/(.+\.css)$ admin/includes/combine.inc.php?type=css&files=$1        [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Previous

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 26 guests

cron