Montego Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic
Author Message
ssj5gabry
Newbie
Newbie



Joined: Jan 24, 2012
Posts: 2

PostPosted: Fri Feb 17, 2012 7:58 am Reply with quote

is there a way to directly convert the link:

"http://www.sitename.com/modules.php?name=News",

rather than putting the link like this?

"modules.php? name = News"
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Feb 18, 2012 11:22 am Reply with quote

ssj5gabry,

I am assuming that "http://www.sitename.com" is the domain of your site. Personally, any internal links to my site I have made strictly relative. There is no benefit to making them fully qualified. This would fix this issue.

But, if you have this content buried within your content, yes, you can more fully qualify the rule. You just need to comply with valid REGEX syntax rules. In your example, instead of:

Code:

'"(?<!/)modules.php\?name=News(?!&)"',


It could be this:

Code:


'"http://www\.sitename\.com/modules.php\?name=News(?!&)"',


I cannot recall right now whether the forward slashes also need to be escaped with a back-slash.

You would have to adjust the corresponding rewrite as well.

NOTE: I do not recommend this approach. Instead, it would be better to adjust your content for internal links to avoid using absolute links.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
ssj5gabry
Newbie
Newbie



Joined: Jan 24, 2012
Posts: 2

PostPosted: Tue Mar 27, 2012 2:35 am Reply with quote

I solved it:
Code:
$urlin = array(
'"(?<!/)('.$nukeurl.'/|)modules.php\?name=News&[amp;]*page=([0-9]*)"',
'"(?<!/)('.$nukeurl.'/|)modules.php\?name=News&[amp;]*op=article&[amp;]*sid=([0-9]*)&[amp;]*title=([a-zA-Z0-9-/]*)"',
'"(?<!/)('.$nukeurl.'/|)modules.php\?name=News&[amp;]*op=category&[amp;]*cid=([0-9]*)&[amp;]*title=([a-zA-Z0-9-/]*)&[amp;]*page=([0-9]*)"',
'"(?<!/)('.$nukeurl.'/|)modules.php\?name=News&[amp;]*op=category&[amp;]*cid=([0-9]*)&[amp;]*title=([a-zA-Z0-9-/]*)"',
'"(?<!/)('.$nukeurl.'/|)modules.php\?name=News&[amp;]*op=send_news&[amp;]*ok=([a-z]*)"',
'"(?<!/)('.$nukeurl.'/|)modules.php\?name=News&[amp;]*op=send_news(?!&)"',
'"(?<!/)('.$nukeurl.'/|)modules.php\?name=News(?!&)"',
);

$urlout = array(
$nukeurl.'/news-pg-\\2.html',
$nukeurl.'/article-\\2-\\3.html',
$nukeurl.'/cat-articles-\\2-\\3-pg-\\4.html',
$nukeurl.'/cat-articles-\\2-\\3.html',
$nukeurl.'/news-send-ok-\\2.html',
$nukeurl.'/news-send.html',
$nukeurl.'/news.html',
);



but I have a problem with the newsletter. I can not get my form to read "Newsletter" because the first rewrite the law for the "News"...

P.s.
I am also the developer code www.lgnuke.org
a demonstration you can see it here www.unime.eu/studenti/
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Tue Mar 27, 2012 8:55 am Reply with quote

Just need to add the Newsletter rewrites ahead of the News ones and then it will work fine. Wink
 
View user's profile Send private message Visit poster's website
emankhan
Newbie
Newbie



Joined: Jan 29, 2015
Posts: 2

PostPosted: Wed Feb 04, 2015 7:22 am Reply with quote

Just a minor issue I ran across, is that the php comment style used in Shortlinks.htaccess will crash your site if pasted into .htaccess. No biggie but it took me a moment to find the error of my ways...
 
View user's profile Send private message
rovshan2
Newbie
Newbie



Joined: Nov 10, 2015
Posts: 4

PostPosted: Tue Nov 10, 2015 12:29 pm Reply with quote

Please advise how to implement rewrite rules for News in template.php file. Just would like to send newsletters to subscribers with html links.
Thanks
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Nov 14, 2015 11:37 pm Reply with quote

ShortLinks will not work for the Newsletters which get generated and sent out in email or their archives. You must modify your HTML within the template.php file to have the shortened links that you want. For example, this code from Fancy_Content/template:

Code:

<a href="{SITEURL}/modules.php?name=News&amp;file=article&amp;sid={NEWSID}" title="">


Might be re-coded as this to match the ShortLinks pattern for News article links:

Code:

<a href="{SITEURL}/article{NEWSID}" title="">


This should give you some idea on where to begin. Each link you want shortened, you'll need to manually adjust the code in template.php to match a valid ShortLink pairing.

montego

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 4 Hours
 
Forums ©
linear-bunch
linear-bunch