简体   繁体   中英

mod_rewrite for seo friendly urls with 5 parameters

I have a page in the following location: /property/happy_property_urls.php

My goal is to make the happy looking url's look like this: /en/london/apartment/for-rent/ww123/

I have tried various methods but none of them seem to stick and I only get 404 errors.

EXAMPLE NOT WORKING

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /property/
RewriteRule ^(.*?)$ happy_property_urls.php?lang=$1&city=$2&type=$3&status=$4&ref=$5 [NC,L,QSA]
</IfModule>

I am sadly failing badly.

Can someone give me some pointers please?

You can use this rule in the .htaccess in the root .

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ property/happy_property_urls.php?lang=$1&city=$2&type=$3&status=$4&ref=$5 [NC,L,QSA]
</IfModule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM