Jump to content

neat url


sandrob57

Recommended Posts

Mod Rewrite; Basically in your root directory...

make a file called .htacess.

 

 

.htaccess

# Rewrite Mod

RewriteEngine on
RewriteBase /
RewriteRule ^user/(.*)$ myfancyurl.com/user/profile.php?lookup=$1 [L]

 

ok here it is:

RewriteEngine on ; turn the engine on

RewriteBase / ; set the root directory.

RewriteRule ^user/(.*)$ myfancyurl.com/user/profile.php?lookup=$1

^ = start

(.*) = userid as a variable

$ = end of match.

then $1 = value of (.*).

And i forgot. [L] = last action

 

So you now make your links. /user/192643

Link to comment
https://forums.phpfreaks.com/topic/58436-neat-url/#findComment-289761
Share on other sites

xyn love the given example.

 

I am studying mod_rewrite can you kindly tell me if you use a regular exspristion in mod_rewrite

the regulalr exsprision is the same as what eregi or preg dont get it cheers.

 

If you could write your example but with the correct regular exspression please.

 

 

Sorry to but in cheers.

Link to comment
https://forums.phpfreaks.com/topic/58436-neat-url/#findComment-289775
Share on other sites

# Rewrite Mod

RewriteEngine on
RewriteBase /
RewriteRule ^[a-z]{0,10}\/\(\.\*\)\.(html)\$[a-z}{1,10}\.
[a-z]{0,3}\/[a-z]{1,4}\/[a-z]{0,10}\.[a-z{0,3}\?[a-z]{0,10}\=\$1 [L]

 

now if i am write now you can have the url

 

 

/user/192643.html

 

now you can get in the seach engine as friendly.

Link to comment
https://forums.phpfreaks.com/topic/58436-neat-url/#findComment-289800
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.