|
htaccess
Make a .htaccess fileIf .htaccess file creation/updating failed because of file permission, you'll have to manually make one. It's simple. Case: YOURLS installed on rootIf YOURLS root URL is http://yoursite/, the .htaccess file in the root directory must be like: # BEGIN YOURLS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /yourls-loader.php [L]
</IfModule>
# END YOURLSCase: YOURLS installed in subdirectoryIf YOURLS root URL is http://yoursite/somedir/, the .htaccess file in this subdirectory must be like: # BEGIN YOURLS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /somedir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /somedir/yourls-loader.php [L]
</IfModule>
# END YOURLSBonus: Force non-WWWAdd this after the YOURLS block in your .htaccess file, replacing yourls.org with your own domain # BEGIN WithoutWWW
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.yourls\.org$ [NC]
RewriteRule ^(.*)$ http://yourls.org/$1 [R=301,L]
# END WithoutWWWThis directive MAY or MAY NOT work on your host (ie http://sho.rt/stuff might work fine and http://www.sho.rt/stuff might not). If it doesn't work, simply stick to one domain, either with or without www. There is no real support for both www and non-www domain setup. (This is unlikely to get improved, to be honest. I don't get why people insist on adding 4 extra characters ("www.") to their URL shortener...) Note: comments here are not monitored. Don't expect support from the project here.
|
Note that this doesn't work if your admin folder is using htpasswd protection to authenticate users.
I would suggest adding this to the .htaccess to make sure people can reach the admin folder even when htpasswd protection is in place.
RewriteCond %{REQUEST_URI} (/|\.php|/[^.]*)$ [NC]And if you use the QR code plugin, you should use this rule instead:
RewriteCond %{REQUEST_URI} (/|\.php|\.qr|/[^.]*)$ [NC]If you see all of the files of Yourls listed when you call your short-url without any short url
'http://myshortdomain.url' instead of 'http://myshortdomain.url/link'
then just put some simple index.html in same directory where you have installed Yourls.
Hey has anyone translated these rules to work with nginx?
here is the .htaccess code if you want to force www if that is how your install domain is in config.php
RewriteEngine? On RewriteCond? %{HTTP_HOST} !^www\. RewriteRule? ^(.)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
I'd like to second the request for the correct nginx rewrite configuration. I've used this one here http://foolrulez.org/blog/2009/08/foolz-us-make-yourls-work-on-nginx/ but it doesn't support the + for stats.
Ok, I've found the solution to the nginx rewrite problem - it was in the comments on the Foolrulez website:
Is it possible to redirect the root domain without affecting the rest of the shortened URLs?
you sould add this to your .htaccess
RewriteEngine? on RewriteCond? %{HTTP_HOST} yourshorturl\.com NC? RewriteCond? %{REQUEST_URI} ^/$ Rewriterule ^(.)$ http://redirectedhere.com/ [L,R=301]
This should do the trick.
Duh... you simply put <?php header('Location: http://blah/'); ?> in an index.php .....
Erm.. it's not really a "Duh" moment.. putting the header / location in the index file generates a cyclic redirect. However - I also can't use the comment above
No it does not generate a cyclic redirect... Unless you redirect it to itself, obviously.
Got Something
HEHEHE
ohhk, it's of google, now i'll believe it 100% ...
If you are installing it in a subdirectory, how would you modify > Bonus: Force non-WWW
i really think to make your install as safe as possible you should ad:
# Prevent .htaccess and .htpasswd files from being viewed by web clients <Files "^\.ht">
</Files># Protect files <Files ~ "^(.)\.(inc|inc\.php|tpl|sql)$"> </Files>
# Disable directory browsing Options -Indexes
...still get the message: You don't have permission to access /admin/install.php on this server and I followed the guideline for version 1.4.3 precisely. Can't access this tool :-(