Page 1 of 1

Yet another mod rewrite problem

Posted: Wed Aug 08, 2012 5:16 pm
by ChrisJC
I have enabled mod_rewrite in the admin control panel.
Renamed the _.htaccess to .htaccess
Tried numerous RewriteBase paths but cannot get it to work.
I'm sure the path is the error, but I can't seem to find it. I'm using phpMyFAQ on a subdomain.
The error I'm getting is 400 Bad Request on all attempts:
RewriteBase /
RewriteBase /content/Hosting/e/x/domain.co.uk/subdomains/support/web/
RewriteBase /subdomains/support/web/

How can I find the corrent path to use?
It shouldn't make any difference, but the hosting server is Zeus, so I've had to use a rewrite.script to pass the rewrite to the .htaccess file, but I believe this is working (I've succeded on our main site with a php shopping cart)

Many thanks,
Chris

Re: Yet another mod rewrite problem

Posted: Wed Aug 08, 2012 5:33 pm
by Thorsten
Hi,

the .htaccess file is for Apache webservers, not Zeus. It seems your rewrite script screws the rewrite rules for Zeus. As I don't know the Zeus webserver, it'S hard to help...

bye
Thorsten

Re: Yet another mod rewrite problem

Posted: Thu Aug 09, 2012 1:03 pm
by ChrisJC
Hi, for the benefit of other who may experience, I have translated the mod_rewrite rules for use on Zeus servers. This should be saved in a file rewrite.script and doesn't need the .htaccess

I'm still having problems adding QSA meaning things like a highlight option in the url isn't working, it gives a 404 error, if I get it working I'll update. I've tested as much as I can, but there may still be holes.

Code: Select all

#Zeus webserver version of basic Wordpress mod_rewrite rules           

map path into SCRATCH:path from %{URL}           

look for file at %{SCRATCH:path}           

if exists then goto END           

look for dir at %{SCRATCH:path}           

if exists then goto END           

##### FIX FOR LOGIN/FORGOTTEN PASSWORD/ADMIN ETC #####   

#match URL into $ with ^support.expressware.co.uk/.*$   
#if matched then goto END

match URL into $ with ^/template/.*$   
if matched then goto END

match URL into $ with ^/admin/.*$  
if matched then goto END

#start page
match URL into $ with ^/index\.html$
if matched set URL = /index.php

# show all categories
match URL into $ with ^/showcat\.html$
if matched then set URL = /index.php?action=show

# the search page
match URL into $ with ^/search\.html$
if matched then set URL = /index.php?action=search

# the add content page
match URL into $ with ^/addcontent\.html$
if matched then set URL = /index.php?action=add

# the ask question page
match URL into $ with ^/ask\.html$
if matched then set URL = /index.php?action=ask

# the open questions page
match URL into $ with ^/open\.html$
if matched then set URL = /index.php?action=open

# the help page
match URL into $ with ^/help\.html$
if matched then set URL = /index.php?action=help

# the contact page
match URL into $ with ^/contact\.html$
if matched then set URL = /index.php?action=contact

# the instant response page
match URL into $ with ^/instantresponse\.html$
if matched then set URL = /index.php?action=instantresponse

# a page with a record (backward compatibility)
match URL into $ with ^/([0-9]+)_([0-9]+)_([a-z\-]+)\.html$
if matched then set URL = /index.php?action=artikel&cat=$1&id=$2&artlang=$3

# a category page with page count (backward compatibility)
match URL into $ with ^/category([0-9]+)_([0-9]+)\.html$
if matched then set URL = /index.php?action=show&cat=$1&seite=$2

# a category page (backward compatibility)
match URL into $ with ^/category([0-9]+)\.html$
if matched then set URL = /index.php?action=show&cat=$1

# sitemap (backward compatibility)
match URL into $ with ^/sitemap-([a-zA-Z0-9]*)_([a-z\-]+)\.html$
if matched then set URL = /index.php?action=sitemap&letter=$1&lang=$2

# a solution id page
match URL into $ with ^/solution_id_([0-9]+)\.html$
if matched then set URL = /index.php?solution_id=$1

# PMF faq record page
match URL into $ with ^/content/([0-9]+)/([0-9]+)/([a-z\-]+)/(.+)\.htm(l?)$
if matched then set URL = /index.php?action=artikel&cat=$1&id=$2&artlang=$3

# PMF category page with page count
match URL into $ with ^/category/([0-9]+)/([0-9]+)/(.+)\.htm(l?)$
if matched then set URL = /index.php?action=show&cat=$1&seite=$2

# PMF category page
match URL into $ with ^/category/([0-9]+)/(.+)\.htm(l?)$
if matched then set URL = /index.php?action=show&cat=$1

# PMF news page
match URL into $ with ^/news/([0-9]+)/([a-z\-]+)/(.+)\.htm(l?)$
if matched then set URL = /index.php?action=news&newsid=$1&newslang=$2

# PMF sitemap
match URL into $ with ^/sitemap/([^\/]+)/([a-z\-]+)\.htm(l?)$
if matched then set URL = /index.php?action=sitemap&letter=$1&lang=$2

# PMF Google sitemap
match URL into $ with ^/sitemap.xml$        
if matched then set URL = /sitemap.google.php

match URL into $ with ^/sitemap.gz$         
if matched then set URL = /sitemap.google.php?gz=1

match URL into $ with ^/sitemap.xml.gz$     
if matched then set URL = /sitemap.google.php?gz=1

# PMF tags page with page count
match URL into $ with ^/tags/([0-9]+)/([0-9]+)/(.+)\.htm(l?)$   
if matched then set URL = /index.php?action=search&tagging_id=$1&seite=$2

# PMF tags page
match URL into $ with ^/tags/([0-9]+)/([^\/]+)\.htm(l?)$     
if matched then set URL = /index.php?action=search&tagging_id=$1


# rest/json API
match URL into $ with ^/api/getVersion                        
if matched then set URL = /api.php?action=getVersion

match URL into $ with ^/api/getApiVersion                     
if matched then set URL = /api.php?action=getApiVersion

match URL into $ with ^/api/search/([a-z\-]+)/([a-z\-]+)$     
if matched then set URL = /api.php?action=search&lang=$1&q=$2

match URL into $ with ^/api/getCategories                     
if matched then set URL = /api.php?action=getCategories

match URL into $ with ^/api/getFaqs/([a-z\-]+)/([0-9]+)       
if matched then set URL = /api.php?action=getFaqs&lang=$1&categoryId=$2

match URL into $ with ^/api/getFaq/([a-z\-]+)/([0-9]+)        
if matched then set URL = /api.php?action=getFaq&lang=$1&recordId=$2

Re: Yet another mod rewrite problem

Posted: Thu Aug 09, 2012 1:07 pm
by Thorsten
Hi,

pretty cool, I would add this to 2.7.8 if you like and if it's okay for you!

bye
Thorsten

Re: Yet another mod rewrite problem

Posted: Thu Aug 09, 2012 1:16 pm
by ChrisJC
Hi,

That's fine with me. The only problem is when going to an article from a search - the added query is giving the 404, for example on our site:
http://support.expressware.co.uk/?searc ... tegory=%25
the links to the actual article return 404 errors.

Is it possible to switch off the highlighting function?
Thanks,
Chris

Re: Yet another mod rewrite problem

Posted: Thu Nov 29, 2012 9:06 pm
by Markees
ChrisJC wrote:Hi,

That's fine with me. The only problem is when going to an article from a search - the added query is giving the 404, for example on our site:
http://support.expressware.co.uk/?searc ... tegory=%25
the links to the actual article return 404 errors.

Is it possible to switch off the highlighting function?
Thanks,
Chris
What is the problem with the highlighting function? Does it only appear when something is highlighted?

Anyways thanks for the solution and coding. As soon as my portal is online again, I will see if I can implement it.

BR