last day (15 days later) » 

11:01 PM
1
A: Translate/change query strings in URL

Leo128the following seems to work for the first and second case RewriteEngine on RewriteCond %{QUERY_STRING} edit=(.*) RewriteRule (.*)/ $1/edit/%1? [NE,L] RewriteCond %{QUERY_STRING} updated=true RewriteRule (.*)/ $1/updated? [NE,L] As I stated in the comment above, # anchors are never sent to th...

 
AWA
Hmm, I'll get no 500 or any other error but it doesn't change query string, it also gives 404 if you insert it manually. Could that be affecting if my url structure is www.my-site.com/page/?edit=post-id? Note that I have front-end page where you can submit/edit page. Update also adds up like that: ?edit=post-id&updated=true
 
I am sorry I posted the wrong link to the mod_rewrite tester. now it is okay. Try htaccess.madewithlove.be. I am sorry but I have no other means to test at the monent. I'll update if I get a clue
 
AWA
That's very odd, tester changes it successfully but it doesn't apply in "real" situation. Does https changes anything?
 
https should not interfere, except that you have to put your mod_rewrite rules in the proper apache .conf file which usually differs from the one used for http.
I tested it on a real apache 2.4 installation on ubuntu 14.04, it works indeed. maybe the problem is not with the rules. could you turn rewrite_log on and post your results please? follow this post stackoverflow.com/questions/9632852/… . Please note that you cannot do that in .htaccess
 
AWA
Im working on it but I can't locate any config files. Any idea what it might be called? I've got Apache 2.4.10 and FreeBSD OP. Docs say it's httpd.conf but I can't see it and I don't know nothing about servers. Maybe host has disabled/hid main config files.
Hi!
 
11:03 PM
unfortunately I don't happen to use freebsd. it shouldn't be so much different than debian in principles... try starting a terminal, logging as root and typing apache2ctl -V and see the output.
my output is as follows:
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/etc/apache2"
-D SUEXEC_BIN="/usr/lib/apache2/suexec"
-D DEFAULT_PIDLOG="/var/run/apache2.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="mime.types"
 
AWA
It seems that updated=true worked but in totally wrong page - admin page. I got 404.
I've never used terminal, can this be done in FTP?
Or I need another program?
 
uhm no, some kind of terminal or terminal emulator is the way... but if it is a shared host I don't think you will have ssh access.
when I was testing the rules I noticed one thing...
 
AWA
Yes, Im currently using shared host - until I complete my site.
 
one common error is believing that mod_rewrite works before the normal apache2 flow... I mean... in order to make thing work I had to make sure the folder structure that I wanted to be rewritten did not really exist... otherwise apache2 will find the contents and mod_rewrite will not do anything.
 
AWA
If that's the case, I might not have that access indeed. It sounds that this file changes setting to whole server, including the ones I share server with. Sounds logical.
 
11:08 PM
yea that's why .htaccess exists in the first place
logging facilities are usually limited on shared host, because log files can potentially consume lots of storage...
 
AWA
Yes, I already saw that. Completly other question but how to delete or empty logs files? I can't delete the file or delete content in text editor and then save it. It already takes much space.
error.log and transfer.log
Also can't change permissions.
 
I usually do that in terminal... its simply echo "" > /var/log/apache2/error.log
you can't do such things on shared hosts. If I were you I'd fire up a VM and install ubuntu (or freebsd) on it.
it takes some time to get the hang of vms but in the end, it's definitely worth it
 
AWA
Yeah.. I belive that's not the option right now. I started with all this 9 months ago and learning like 3 languages, CSS, HTML etc has taken lots of energy and time. I think I let others to deal with my server right now. I'll learn that if site is ready.
 
this might be better option since I could never have gotten the behaviour of mod_rewrite without looking at the logs... it's definitely complicated.
 
AWA
Terminal got me interested, debugging for example has always been a problem because downloading error.log is always time and resorce consuming. Any good suggestions about that?
 
11:17 PM
I usually have the box at hand... I mean, I can natively connect via secure shell (ssh) and access error.log directly. otherwise it might be possible that on some shared hosts you can configure syslog to send the logs elsewhere (say your logging server)
 
AWA
Never even heard about terminals.
What terminal do you suggest?
 
like smoke-signals terminals almost don't exist anymore... usually you'll have a terminal emulator in front of you
that said, any unix distro comes with at least three of them
the terminal itself only deals with characters from the keyboard and the console (say 'display')
so... basically I'd simply download ubuntu and press CTRL+T to open a good terminal
 
AWA
You've ever set up own server? I imagine it requires some serious hardware and highspeed upload/download internet.
 
then thru the terminal, you will use a 'shell', like SH, SSH, BASH, KSH and so on...
as of today I simply get an account on cloud.it (I live in italy) and they host a running virtual private server pretty well. it's a VM, online. so I have the benefits of my own server with the speed of their network
it costs some cent each minute... a VM good for developing will consume close to 30€ / month
 
AWA
I've also never heard about VM. I imagine this stands for virtual machine?
 
11:25 PM
exactly
one place to start is Oracle VM VirtualBox... very good and free. also it has a very nice and intuitive gui to control vms. it will change the way you look at hardware.
it also runs on mac, unix, linux, windows... pretty much everywhere
 
AWA
Thanks for the tips! I'll fire up Youtube and see if I like it and how hard it is to get hang of it.
 
it's pretty strightforward... only make sure you have some cd or dvd installation images of some OS.
 
AWA
As for my query string, I guess I can live with them for now and come back to them later.
But thanks you for your time.
 
You are welcome!
 

last day (15 days later) »