.htaccess mod_rwrite doesn't work

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
Minime
Posts: 19
Joined: Fri 11. Mar 2005, 18:07

.htaccess mod_rwrite doesn't work

Post by Minime »

Hello,

I'm trying to get the website I'm improving to use better uri's. So I did what I should, I changed conf.inc.php and set $phpwcms["rewrite_url"] to 1.

I also changed the .htaccess file, it now looks like this:

Code: Select all

php_flag magic_quotes_gpc Off
php_flag register_globals Off

RewriteEngine On

RewriteBase /mimizan
RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.shtml$ /mimizan/index.php?id=$1.$2.$3.$4.$5.$6
RewriteRule ^(.+)\.shtml$ /mimizan/index.php?$1 
I left out the commented parts.
The site is in the subdirectory called mimizan.
The parent dir hasn't got a .htaccess file which could override it
My host does support the .htaccess and the rewrite rules.
It is an apache server

I have used aliases.

Now I wonder why I don't get uri's like

http://www.site.ext/home.phtml

Can anyone help me out?
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

change this
.......9]+)\.shtml$
to
.......9]+)\.phtml$
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
Minime
Posts: 19
Joined: Fri 11. Mar 2005, 18:07

Post by Minime »

It's not really the extension that's bothering me it's the fact it doesn't use the aliases I set, somehow it doe a little of rewriting but not all.

I've got nou Uri's like: http://sitedezign.net/mimizan/2.0.0.1.0.0.shtml
without any rewriting this would be http://sitedezign.net/mimizan/index.php?id=2.0.0.1.0.0

but what I want is: http://sitedezign.net/mimizan/alias (with or without an extension like .shtml or anything like that.
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

hi

Code: Select all

RewriteBase /mysubdir
RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.shtml$ /mysubdir/index.php?id=$1.$2.$3.$4.$5.$6
RewriteRule ^(.+)\.shtml$ /mysubdir/index.php?$1 
this is the original Version - but there should NO Carrige-Return or LF after '+)\.phtml$' what I mean is the this

Code: Select all

RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.shtml$ /mysubdir/index.php?id=$1.$2.$3.$4.$5.$6
have to be one Line.


and this is the Version I use (no Subfolder)

Code: Select all

RewriteEngine On

RewriteBase /
RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.phtml$ /index.php?id=$1.$2.$3.$4.$5.$6
RewriteRule ^(.+)\.phtml$ /index.php?$1 
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
Minime
Posts: 19
Joined: Fri 11. Mar 2005, 18:07

Post by Minime »

pico wrote:

Code: Select all

RewriteEngine On

RewriteBase /
RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.phtml$ /index.php?id=$1.$2.$3.$4.$5.$6
RewriteRule ^(.+)\.phtml$ /index.php?$1 
That's about the same one I use except for the subfolder I use...

Now I wonder in what part of the code does the alias come in?
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

the ALIAS must be in Sitestructure in every Structurelevel.
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
Minime
Posts: 19
Joined: Fri 11. Mar 2005, 18:07

Post by Minime »

Realy strange, since I've got that as well. I even checked my DB but every row has an alias.

An other strange thing is the fact that I've redirected the Home to index.php but when I go to /mimizan/index.php I get my article and when I use the link of Home I don't get that article..
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

I'm confused too :oops: when I call /mimizan/index.php I get a Page and all Links from the Navigation are ending with .html - are there 2 different Sites on this Address?
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
Minime
Posts: 19
Joined: Fri 11. Mar 2005, 18:07

Post by Minime »

I'm sorry for that, I made some changes which now enables me to get the url's right. At least what's used as an URL is correct though it doesn't work yet. Since when I now use the link it'll return a 404.

I've used this method:
http://ionrock.umemusic.com/index.php?id=6,11,0,0,1,0

So now it uses the aliases as an url but it now can't find the information.

edit: Something else => In the end I'd like to get rid of the extension totally:

http://sitedezign/surfen/wetsuits.html would become http://sitedezign/surfen/wetsuits

I reckon that it's possible but this is not Important at the moment, at the moment I just hope to get it working...
Minime
Posts: 19
Joined: Fri 11. Mar 2005, 18:07

Post by Minime »

Somehow it does work now, thnx Pico
Post Reply