| |
| |
|
|
|
|
| |
|
| |
|
| :: |
| Author |
Message |
spiritweb

Joined: 11 Sep 2008 Posts: 2 Location: UK
|
Posted: Fri Sep 12, 2008 12:04 am Post subject: Help! Custom Joomla Simple Re-write |
|
|
Hi There
This is my first post on the forums I hope that someone could help me with what should be a simple problem
I need to redirect a url using mod rewrite, and then rewrite the output url back to the origional without it looping
for example someone types mydomain.com/mypage and mod rewrite redirects this to mydomain.com/option=blagh?usr?mypage but the url stays looking as the user had typed, heres an example of what I belive to be the impossable
if a user typed mydomain.com/test
I'd need it to redirect to:
http://mydomain.com/index.php?option=com_joomlawiki&page=test&page_heading=&show_pageheading=&allowanonymoususers=
I have tried things like:
| Code: | RewriteRule ^([a-z0-9_-]) index\.php\?option=com_joomlawiki&page=$1&page_heading=&show_pageheading=&allowanonymoususers= [R=301,L]
RewriteRule ^(.*)([a-z0-9_-]) /wiki/$1 [QSA,L,NC]
RewriteRule ^/index.php?option=com_joomlawiki&page=([a-z0-9_-])&page_heading=&show_pageheading=&allowanonymoususers= $1
RewriteRule rewrite_from rewrite_to
RewriteRule ^(.*)index\.php\?option=com_joomlawiki&page=([a-zA-Z0-9]+)&page_heading=&show_pageheading=&allowanonymoususers=$ /wiki/=$2 [NC,L]
RewriteRule ^(.*)index.php?option=com_joomlawiki&page=([a-zA-Z0-9]*)&page_heading=&show_pageheading=&allowanonymoususers= wiki/=$2
RewriteRule ^(.*)index.php?option=com_joomlawiki&page=[a-zA-Z0-9._-]&page_heading=&show_pageheading=&allowanonymoususers= wiki/=$2
RewriteRule ^/index.php?option=com_joomlawiki&page=[0-9A-Z]&page_heading=&show_pageheading=&allowanonymoususers= wiki/=$6
RewriteRule ^/index.php?option=com_joomlawiki&page=([0-9A-Z]*)&page_heading=&show_pageheading=&allowanonymoususers= wiki/=$6
RewriteRule ^/index.php?option=com_joomlawiki&page=removeme&page_heading=&show_pageheading=&allowanonymoususers= wiki/=$1
below is meant to redirect whatever to the $1 so I dont have to use error catching to direct to wiki
RewriteRule ^[0-9A-Z] /index.php?option=com_joomlawiki&page=$1&page_heading=&show_pageheading=&allowanonymoususers= |
without any luck and I guess it has something to do with the default Joomla Htaccess file here:
| Code: | #####################################################
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations. It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file. If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's. If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################
## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
#
# mod_rewrite in use
RewriteEngine On
########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)
# RewriteBase /
########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
# RokBridge SEF change forum configuration.php.
RewriteRule ^/forum/ forum/index.php [L]
|
It doesn't accept any of my rules anyone up for the challenge of giving a mod newb some help ?  |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15242
|
Posted: Sat Sep 13, 2008 4:05 pm Post subject: Re: Help! Custom Joomla Simple Re-write |
|
|
To url rewrite example.com/test to example.com/index.php?option=com_joomlawiki&page=test&page_heading=&show_pageheading=&allowanonymoususers=
You'd only need something like :
| Code: | RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9_-])/?$ /index.php?option=com_joomlawiki&page=[b]test[/b]&page_heading=&show_pageheading=&allowanonymoususers= [QSA,L,NC] |
But of course, example.com/index.php?option=com_joomlawiki&page=test&page_heading=&show_pageheading=&allowanonymoususers= needs to be a working url.
In you joomla .htaccess, you'd need to place this :
| Code: |
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9_-])/?$ /index.php?option=com_joomlawiki&page=[b]test[/b]&page_heading=&show_pageheading=&allowanonymoususers= [QSA,L,NC] |
before :
| Code: | | ########## Begin - Joomla! core SEF Section |
Should work, but won't actually rewrite the links, it will only allow them to work.
By the way, I'm not very sure about this last rewriterule :
| Code: | | RewriteRule ^/forum/ forum/index.php [L] |
I don't know the exact usage, but it rather should be something like :
| Code: | | RewriteRule ^forum/?$ /forum/index.php [QSA,L] |
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
spiritweb

Joined: 11 Sep 2008 Posts: 2 Location: UK
|
Posted: Sun Sep 14, 2008 6:56 pm Post subject: Thankyou So Much |
|
|
Thankyou Admin
You are amazing I had been putting my rules after Joomla ones all along, I eventually found this to work:
| Code: |
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?option=com_joomlawiki&page=$1&page_heading=&show_pageheading=&allowanonymoususers= [QSA,L,NC] |
above the joomla rules, the last rule you mention is for rocketworks phpbb3 bridge, I haven't tried it yet using SEF.
I'm definatly mentioning a special thanks in the credits at mortalwiki.com when I post them up, as I have been trying to fix that for ages  |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15242
|
|
| Back to top |
|
 |
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |