PaulTurner-awin / stikked

Automatically exported from code.google.com/p/stikked
GNU General Public License v3.0
0 stars 0 forks source link

Shorten URLs to www.domain.com/paste-id #28

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. generate any paste on standard installation

What is the expected output? What do you see instead?
Well, it's not convenient having /index.php/view/paste-id.

What version of the product are you using? On what operating system?
The one available as of 9-11-11.

Please provide any additional information below.

In the file /system/application/models/pastes.php

Line 246 or so, the one with the $data[url] one. REPLACE THIS ENTIRE LINE with 
the following code:

$data['url'] = preg_replace("/(^http:\/\/.*?)\/(.*?)(\/.*)/", '$1$3', 
site_url('/'.$row['pid']));

Then in the main .htaccess file, replace all content with this:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule ^([a-zA-Z0-9_-]+)$ index.php/view/$1 [L]
</IfModule>

Original issue reported on code.google.com by supp...@u4ik.us on 12 Sep 2011 at 1:57

GoogleCodeExporter commented 8 years ago
When you create a new paste, the URL in the address bar is still the old one, 
while the link to it is as you've posted.
Any way to fix that?

Original comment by episo...@gmail.com on 6 Oct 2011 at 12:20

GoogleCodeExporter commented 8 years ago
Yes, I'll work on that this weekend. I just wanted a hotfix for the original 
problem. I assume (not tested yet) that you can pop in the $data...['pid'])); 
line (from my first post) into the page that does the actual job (and displays 
the paste itself) but I haven't looked into it. I'll reply when I find a fix 
for that.

Thanks for udnerstanding.

Original comment by supp...@u4ik.us on 6 Oct 2011 at 4:44