Welcome! Log In Create A New Profile

Advanced

mod_rewrite migration (Adding a slash)

Posted by Goose 
mod_rewrite migration (Adding a slash)
March 30, 2009 06:31PM
Hey,

I hope you don't mind me asking a probably simple question: I changed my webserver from apache to nginx. I migrated my rewrite rules, except one, successfully to nginx's config. I've used this rule in my .htaccess to add a '/' at the end of every url (e.g. www.example.com/news -> www.example.com/news/) pointing to a page:
[code]
'RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$' and
'RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]'
[/code]
Now I tried to do that with nginx but it is not working very well. When using the main url www.example.org, the rule adds '//' and the site gets in a loop.
[code]
rewrite ^/([^/]*)\/$ /index.php?p=$1 last;

if (!-f $request_filename) {
rewrite ^/(.*)$ h**p://$host/$1/ last; <- http changed to prevent hotlinking
}
[/code]
It would be great if somebody could help me. Is there a problem with double content for search indexes (e.g. Google)?

Thanks in advance.

PS: I am a bit confused that I am the first poster in this section. Am I allowed to post in here?
Re: mod_rewrite migration (Adding a slash)
March 31, 2009 07:55AM
I got it working myself, just needed a little nap. ;)
Re: mod_rewrite migration (Adding a slash)
March 31, 2009 01:01PM
Goose Wrote:
-------------------------------------------------------
> PS: I am a bit confused that I am the first poster
> in this section. Am I allowed to post in here?

Sorry I didn't see this until now. Yes, you are allowed to post here.

This is a "new" forum so that is why you are first. Welcome!

--
Jim Ohlstein
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 141
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready