Webmastersite.net
Register Log In

Mod Rewrite
Change Display URL

Comments on Mod Rewrite

janhendrik
Beginner

Usergroup: Customer
Joined: Jan 28, 2004

Total Topics: 2
Total Comments: 5
Posted May 28, 2006 - 6:15 AM:

Hi Paul!

I tried to use the mod-rewrite option. At first, each link looks similar to:

http://www.yourdomain.com/36 (for categories)
http://www.yourdomain.com/links/654 (for outgoing links)
http://www.yourdomain.com/detail/link-name-35.html (for detail page)



1.
Ok, I like to use following style for outgoing links:
http://www.yourdomain.com/links/654.html
or much better (but not tested)
http://www.yourdomain.com/links/linktitle.html

I changed the .htaccess:
RewriteRule ^links/([a-z]+)/([0-9]+).html$ link.php?action=$1&id=$2
RewriteRule ^links/([0-9]+).html$ link.php?id=$1

Now, I have to change the modrewrite.php, right?
Wich line I have to change? I tried to change line 58 & 66 from:
$altered .= $settings->rewritelink .'/'. $action .'/'. $getid[1];

to
$altered .= $settings->rewritelink .'/'. $action .'/'. $getid[1].'.html';

But nothing happens.



2.
Last but not least, I like to use following style for catlinks:
http://www.yourdomain.com/catname/ (with trailing back-slash)
and for subcategories:
http://www.yourdomain.com/catname/subcatname/ (with trailing back-slash)

So far, what I have to do?

BG
Jan


Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted May 30, 2006 - 11:20 PM:

or much better (but not tested)
http://www.yourdomain.com/links/linktitle.html[/i]

That means your site dies when you have two links with the same title. You don't want that. It's very easy two sites to be titled the same.

http://www.yourdomain.com/links/654.html

If you want to remove the keywords from your URL to defeat the whole point of mod_rewrite, admin panel->settings->search and SEO offers you this option. Type in the new format you want there and edit your .htaccess to reflect your change.

http://www.yourdomain.com/catname/ (with trailing back-slash)

Not that I have any idea why you'd want to do that, but you can change the rewritepath function of classes/categories.php to tack on $path .= '/'; before the last line if you want to break compatibility for it.
janhendrik
Beginner

Usergroup: Customer
Joined: Jan 28, 2004

Total Topics: 2
Total Comments: 5
Posted May 31, 2006 - 8:10 AM:

a.)
http://www.yourdomain.com/links/linktitle.html

That means your site dies when you have two links with the same title. You don't want that. It's very easy two sites to be titled the same.

http://www.yourdomain.com/links/654.html


Oh, that's right. Due to I like to have the title in my links, so we can have also the ID inside for unique links, e.g.:

http://www.yourdomain.com/links/linktitle-654.html




b.)
Not that I have any idea why you'd want to do that, but you can change the rewritepath function of classes/categories.php to tack on $path .= '/'; before the last line if you want to break compatibility for it.


Trailling Slash works fine, thank you.
But for Pagination, we have now following style:

http://www.yourdomain.com/catname//2/

same by eg.g Admin Edit:

http://www.yourdomain.com/catname//edit.php?action=link&field=id&condition=equals&fieldvalue=695

Also, if I set "Use category names in URL: YES" nothing happens, WSN produce only the CATID.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jun 02, 2006 - 4:03 AM:

a) That being a default option.

b) Then I guess the trailing slash isn't an option, if it causes problems, though I don't see why it would.

Also, if I set "Use category names in URL: YES" nothing happens, WSN produce only the CATID.

Are there special characters in the name?
janhendrik
Beginner

Usergroup: Customer
Joined: Jan 28, 2004

Total Topics: 2
Total Comments: 5
Posted Jun 03, 2006 - 11:27 PM:

a.) yes i saw it now, my stupid question. I am sorry.

b.) Yes, I have some special characters (e.g. "&").
May I remove it all or can i add somewhere similiar like this: $title= preg_replace("/[^a-zA-Z0-9]/","",$title); ?
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jun 05, 2006 - 3:12 AM:

If there's an & in the name it will end up using numeric rewriting -- & isn't legal in URLs. Removing the & in the code would simply make the category dead since it would be trying to find a category named "x y" when the actual category is named "x & y".
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.