PDA

View Full Version : Mod Rewrite Friendly URLs and Apache 1.3


FBChris
03-01-2010, 04:36 PM
Does anyone have the Mod Rewrite Friendly URLs working in combination with Apache 1.3?

I tried using the .htaccess as provided in the /do_not_upload/rewrite/apache2 folder. These rules don't seem to work with Apache 1.3

In my error log the following error shows up...
.htaccess: RewriteRule: cannot compile regular expression '^(?:(.*?)(?:/|$))(.*|$)$'\n


RewriteEngine on

# If you are having problems or are using VirtualDocumentRoot, uncomment this line and set it to your vBulletin directory.
# RewriteBase /forum/

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

# Forum
RewriteRule ^threads/.* showthread.php [QSA]
RewriteRule ^forums/.* forumdisplay.php [QSA]
RewriteRule ^members/.* member.php [QSA]
RewriteRule ^blogs/.* blog.php [QSA]
ReWriteRule ^entries/.* entry.php [QSA]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

# MVC
RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]

Markos
03-02-2010, 10:59 AM
i use this one but it doesn't rewrite it the way it did on 3.8
http://www.vbulletin.com/forum/showthread.php?325798-Mod-Rewrite-Friendly-URLs-gt-.htaccess/page12

FBChris
03-02-2010, 02:33 PM
Do you use that one with Apache 1.3?

It gives me a similair problem...
RewriteRule: cannot compile regular expression '^threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?))'\n

BSMedia
03-02-2010, 08:12 PM
Is there any chance of upgrading your Apache to 2.x?

FBChris
03-08-2010, 02:02 PM
Upgrading to Apache 2.x is no really possible at the moment. Maybe in a later stage.

For now I have found some information on http://www.vbsupport.org/forum/showthread.php?t=32958. Its in Russian, with Google translate I found out a little bit more...

This error occurs due to that apache 1.3 uses POSIX ERE and apache 2.x uses REGEX. The errors is specifically in the non-capturing clusters "(?: exp)" which is not supported by POSIX ERE or apache 1.3

With some copy and paste from various sources I have come up with a working .htaccess in my Apache 1.3 environment.

RewriteEngine On

# If you are having problems or are using VirtualDocumentRoot, uncomment this line and set it to your vBulletin directory.
# RewriteBase /forum/

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^threads/.* showthread.php [QSA]
RewriteRule ^forums/.* forumdisplay.php [QSA]
RewriteRule ^members/.* member.php [QSA]
RewriteRule ^blogs/.* blog.php [QSA]
ReWriteRule ^entries/.* entry.php [QSA]
RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2&%{QUERY_STRING}
RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING}
RewriteRule ^widget/config/([0-9]+) widget.php?r=config/$1&%{QUERY_STRING}

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^$ $1.php?r=$2 [QSA]

Graex
03-27-2010, 03:57 AM
Thanks! For that last .htaccess

I tried it and it works :)

Been searching like crazy for that and was about to give up. :D

vwdforum
04-03-2010, 09:09 PM
Works for me thanks!

enigmatic_user
08-24-2010, 02:48 PM
RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2&%{QUERY_STRING}
RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING}
RewriteRule ^widget/config/([0-9]+) widget.php?r=config/$1&%{QUERY_STRING}
Why not

RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2 [QSA]
RewriteRule ^content/(.*) content.php?r=$1 [QSA]
RewriteRule ^widget/config/([0-9]+) widget.php?r=config/$1 [QSA]
as it is used in the lines before? [QSA] does just that - it appends the existing Query String.

RewriteRule ^$ $1.php?r=$2 [QSA]
This line can't work - $1 and $2 are references to bracketed expressions - but there are none...

The original line for Apache 2 is

RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]
and can be "translated" to

RewriteRule ^((.*?)(/|$))(.*|$)$ $2.php?r=$4 [QSA]
which is equivalent.

Cheers,
Jan

Breakpoint
09-22-2011, 11:11 PM
Anyone can answer the above question?

fili
06-07-2012, 07:43 AM
hello,

Work well for me but i have a question :

http://www.***.com/content/13-test

13 : number of article
Test : title of article

How to delete in .htaccess the number of article ?
or better
is it possible to change the number of article in title of the section ?