https://www.icyphoenix.com/viewtopic.php?f=35&t=7758
-----------------------------------
KugeLSichA
Fri 01 Apr, 2011 19:09

Mod_rewrite Make_url_friendly For Users
-----------------------------------
Hey there...

i have had spend some hours to figure my problem out... also searched alot, but can find any docs about that...

Icy Phoenix has his own make_url_friendly function...
[quote][b]includes/functions_rewrite.php[/b]
		// Profile
		'/(?<!\/)(.\/){0,1}' . PROFILE_MG . '\?mode=viewprofile((&)|(&)){0,1}' . POST_USERS_URL . '=([0-9]+)((&)|(&)){0,1}([^>]+>)(.*?)<\/a>/e',

		// Profile
		"make_url_friendly('\\10') . '-profile-u\\5.html' . if_query('\\6') . stripslashes('\\9\\10') . '</a>'",
[b].htaccess[/b]
RewriteRule ^.+-profile-u([0-9]*) ./profile.php?mode=viewprofile%{QUERY_STRING}&u=$1 [L]
[/quote]

I have changed this a bit, and have ATM this:
[quote][b]includes/functions_rewrite.php[/b]
		// Profile
		'/(?<!\/)(.\/){0,1}' . PROFILE_MG . '\?mode=viewprofile((&)|(&)){0,1}' . POST_USERS_URL . '=([0-9]+)((&)|(&)){0,1}([^>]+>)(.*?)<\/a>/e',

		// Profile
		"make_url_friendly('\\10') . '-user\\5' . if_query('\\6') . stripslashes('\\9\\10') . '</a>'",
[b].htaccess[/b]
RewriteRule ^.+-user([0-9]*) ./profile.php?mode=viewprofile%{QUERY_STRING}&u=$1 [L]
[/quote]
Which results in: [b]http://www.domain.com/NICKNAME-user2[/b]

But i want to have it like this (i need this for an dynamic image):
[b]http://www.domain.com/member/NICKNAME/[/b]

I´ve played a bit with the make_url_friendly function to achieve that... the rewrite was ok, but the images on the profile were not displayed... due to the "member"-path

The next thing is... i dont really know for what the "\\10" | "\\6" in the make_url_friendly function stand for...

anyone can help me with that please?


-----------------------------------
Informpro
Fri 01 Apr, 2011 22:02

Re: Mod_rewrite Make_url_friendly For Users
-----------------------------------
The main problem is that / is considered as path separator. So you must change the IMG base location, otherwise the browser won't be able to locate files.


-----------------------------------
KugeLSichA
Fri 01 Apr, 2011 22:34

Re: Mod_rewrite Make_url_friendly For Users
-----------------------------------
[quote user="Informpro" post="52216"]The main problem is that / is considered as path separator. So you must change the IMG base location, otherwise the browser won't be able to locate files.[/quote]

yupp... thats the problem...

i found a solution for this...

{FULL_SITE_PATH}{EMAIL_IMG}

then the image is correct... but i need to add this to all templates which are loaded on the profile, overall_header, overall_footer, profile_view_body

thats a lot of work...

so i was asking here if the is maybe a better/easier way...


-----------------------------------
Informpro
Fri 01 Apr, 2011 23:20

Re: Mod_rewrite Make_url_friendly For Users
-----------------------------------
Try to look at the .cfg file.


-----------------------------------
KugeLSichA
Sun 03 Apr, 2011 16:17

Re: Mod_rewrite Make_url_friendly For Users
-----------------------------------
[quote user="Informpro" post="52220"]Try to look at the .cfg file.[/quote]

The images are not the only problem... also Urls are not working...

I know MG dont like the Mod_rewrite thing... but maybe he have a solution for this... (and/or someone else)  8)


-----------------------------------
Mighty Gorgon
Sun 03 Apr, 2011 23:33

Re: Mod_rewrite Make_url_friendly For Users
-----------------------------------
You need a special PHP file to be able to manage those links.

It's not so quick to explain how to deal, I can suggest the HTACCESS part:

[codeblock]<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ip/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ip/users/index.php [L]
</IfModule>[/codeblock]

So you can recall users from the "users" subfolder (for example: kugel.com/users/kugel/) but then you need to strip last subfolder and be able to query the value from users table (maybe the username_clean).

As I said, it's not quick and requires dealing with both HTACCESS and PHP code.


