Author: Xin
WordPress and CertBot non-www to www Redirect with .htaccess file
WWW to non-WWW
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443 [OR]
RewriteCond %{HTTP_HOST} !^example.com
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
non-WWW to WWW
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443 [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
In httpd.conf or your-site.conf, you should disable the re-write rule added by CertBot
#RewriteCond %{SERVER_NAME} =www.example.com [OR]
#RewriteCond %{SERVER_NAME} =example.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
Drupal/Apache 2.4 .htaccess error: Options not allowed here
Update /etc/httpd/conf.d/userdir.conf
<Directory “/home/*/public_html”>
AllowOverride All
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Require method GET POST OPTIONS
</Directory>
Restart httpd.
Sprint Wi-Fi Calling on iPhone, Google Voice Number Verification and some other issues
On 4/9/2015, Sprint released Wi-Fi Calling feature on iPhone. It is good news for Sprint users because Sprint’s wireless signal is really *BAD*. I enabled it on my iPhone 6 and it was pretty straightforward. You go to “Settings”, select “Phone”, you will see “Wi-Fi Calls” switch. Enabling it will ask you to provide your address for emergency 911 etc. You will need Carrier version Sprint 19.1 and iOS 8.3 to have this option.
Wi-Fi calling doesn’t work at my work’s wifi because the wireless network at my work place has a Captive Portal. When I got home and the phone was connected to my home wifi, the phone shows “Sprint Wi-Fi” on display. Making or receiving calls work perfect. Finally I can make calls using this phone at home.
Trouble began when I traveled to Charlottesville, VA.
#1 Can not make or receive calls in certain area
- When I tried to call someone using AT&T wireless service, I got “The number you dialed is incorrect, disconnected or no longer in service”.
- I tried to use my personal phone (AT&T) to call this Sprint phone, the Sprint phone never rings (I forgot if there is any message).
- I was able to call Sprint’s tech support using this phone although the call was dropped due to bad signal. (Shame on you, Sprint!)
- I called Sprint support, the tech asked me to do some simple testing and told me they would have to open a ticket, which (of course) was never resolved.
- I tried to toggle off WiFi calling on my iPhone and it didn’t help either.
- The second day, I went back home from Charlottesville. the phone works with or without WiFi calling toggled on. Sprint calls me back and told me they were not able to find any issues with my line or my device. When I told them it is working in my home area, the guy was happy to help me close the ticket and told me “You can call us again if you are in Charlottesville area and have the same issue”. lol, nice work!
Trouble #2 can’t pass verification of Google Voice
I tried to add this Sprint number to my Google Voice’s forwarding phones. To do this, Google will call me and ask me to type in a two digit verification code. Guess what, it doesn’t work. I received the call but when I input the two digit verification code, Google side can’t get what I typed in. “I am sorry I didn’t catch that”. Although I have already lost confidence on Sprint Tech Support, I contacted them again just in case they have a knowledge base for Google Voice/Sprint, no surprise. They called me back after 48 hours and told me I have to contact Google for support because “the phone works when call Sprint and is able to touch tone dial Sprint’s service menu”.
So I did the following tests and created a post on Google Voice support forum:
- unconditional forwarding calls from Sprint number to a land line number. Picked up the call using the land line phone, still not working: same symptom.
- unconditional forwarding calls from Sprint number to a AT&T number, not working, same symptom.
- set up AT&T number as a forwarding option in Google voice, works right away.
- Remove AT&T number from Google Voice, forward all calls from AT&T number to Sprint Number, try to add AT&T number back to Google Voice forwarding numbers. Not working: Same “I am sorry, I didn’t catch that”.
- I am ABLE to use my sprint phone to access Google Voice’s Voice Mail menu. I was even able to add Sprint number as a temporary forwarding number this way.
- Toggle off “Wi-Fi calls”. didn’t help.
- Call (804) 222-1111 to test DTMF. The system was able to tell my input correctly.
-
I also tried this:1. Remove my AT&T number from my google voice account.2. Forwarding calls from my AT&T number to Sprint number.3. re-add AT&T number to Google Voice account and verify.4. Use Sprint phone to pick up the call and verify….5. Works perfectly.
- Also
1. Used Sprint phone to call my GV number and set it up as temp forwarding number.2. Removed my AT&T number from GV account.3. Use AT&T number to call my GV.4. Pick up my sprint phone when it starts to ring.5. “Press 1 to Accept the call”. I press 1 but it is not working. Just like the verification call. The other side doesn’t recognize my input.
So after the last test, I finally realized this is not tied to Google Voice’s verification call. It looks like DTMF doesn’t work for inbound calls, but outbound calls are fine. I googled around and found a page saying Wi-Fi calling is a feature on the line to enable/remove beside on the phone (sorry I forgot the url).
I called Sprint to ask removing this feature from my phone. Thank you Sprint, they told me I couldn’t because I am not the owner of this account (Sprint number is a business phone from work) so I can’t remove this feature. I said I enabled it myself and now I can’t remove it? “No, you can’t, unless you have the PIN for this account”. (Sprint, I am surprised you are still in business). I asked to talk to her supervisor, her supervisor has better attitude and told me he would reach out to this account’s dedicated business support staff. After 36 hours, I got a call from Sprint, told me that I could remove the feature from my line on the phone! (so you can disable Wi-Fi calls on the line by yourself)
1. Make sure WiFi calling is toggled on.
2. Click “Update Emergency Contact Address”.
3. It will load a web page and Select “Disable Wi-fi calling feature”
I asked him that I read from some web pages, I will have to update my phone’s profile to complete by dialing a number. he said he was not aware of anything like that and suggested me to reboot my iPhone.
Actually, here is the number “##873283#” (##UPDATE#), this will prompt you “Starting Service Update”, Click OK. The phone will get the latest update from the tower.
All of that being done, I re-login to my Google Voice account, click verify my phone again. Phone rings, pick up, type the two digits number. “Your number has been verified”, in one single try.
I believe Sprint routes inbound call differently for Wi-Fi calls enabled iPhone. That causes trouble for the touch tone not recognized by Google Voice.
Lessons learned:
1. Don’t rely on Sprint’s network and tech support. Their network qualify and tech support’s knowledge are on the same level.
2. I should have dug more into “Update Emergency Address”, but who can imagine Sprint put the real “disable wi-fi calling” here?
3. I will never ever buy Sprint’s service for my personal use. I am lucky this Sprint phone is for my work.
Wishes:
Sprint should be bought by Verizon and the name “Sprint” should become history.
Mac OSX Terminal Input Chinese utf-8 Issue
I just realized that under OSX Terminal, I can’t input Chinese correctly, although I have already setup the terminal encoding as utf-8 . All Chinese characters are showing as unreadable.
Solution? Uncheck “Escape non-ASCII input with Control-V” under Terminal/Preferences/Advanced
Outlook 2010 can’t book meeting room as resources on Exchange 2003
First of all, in Exchange 2003, there are not real “Resources” objects. Meeting rooms are like normal users. So Microsoft implemented “Direct Book“, which is implemented on Outlook client side.
in Outlook 2010, this Direct Book option is not enabled by default. If you add a room to resources and send the invite, an invite email is sent to this room user inbox. If nobody monitors this email account, your room will not be booked and the calendar of this room will not be marked as busy. You will realize this when you see other people in the meeting room at your meeting time you are trying to book.
The fix:
Easy done by a registry update.
- Exit Outlook.
- Start Registry Editor.
- Locate and then select the following subkey in the registry:
- HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Options\Calendar
- On the Edit menu, point to New, and then click DWORD Value.
- Type EnableDirectBooking, and then press ENTER.
- Right-click EnableDirectBooking, and then click Modify.
- In the Value data box, type 1, and then click OK.
- Exit Registry Editor.
- Start Outlook.
Done.
More information can be seen at http://support.microsoft.com/kb/982774
How to search for text within multiple files under multiple folders/directories in Linux
find . -type f -exec grep -l “text-to-search” {} +
how to replace text string in multiple files in multiple folders or directories in Linux
find ./ -type f -exec sed -i ‘s/old-string/new-string/g’ {} \;
Custom AccessDenied.aspx Access Denied Page for SharePoint 2010
First you will need to make a copy of the default layout page AccessDenied.aspx which is located at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS
For example, you can call it AccessDeniedNew.aspx. This new page layout should stay in “LAYOUTS” folder.
Login to your server as a farm administrator. Start SharePoint 2010 Management Shell. Run the following code:
$site = get-spsite "http://YOUR_SITE_URL"
$webApp = $site.WebApplication
$webapp.UpdateMappedPage(1, "/_layouts/AccessDeniedNew.aspx")
$webapp.Update()
To switch back to the default page, you can use the following code
$site = get-spsite "http://YOUR_SITE_URL"
$webApp = $site.WebApplication
$webapp.UpdateMappedPage(1, $null)
$webapp.Update()
You can get more information about the custom page from Yaroslav’s blog
In the method of $webapp.UpdateMappedPage, 1 is for Access Denied Page. See the following table for other type of pages
AccessDenied = 1
Confirmation = 2
Error = 3
Login = 4
RequestAccess = 5
Signout = 6
WebDeleted = 7
You can use Set-SPCustomLayoutsPage and Get-SPCustomLayoutsPage to reach the same goal as well.
This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products Configuration Wizard, located on the Start menu in Microsoft SharePoint 2010 Products.
I got this error when I use Visual Studio 2010 to program some SharePoint 2010 stuff. It is a simple console program. This exception happens at the following line:
SPWebApplication webApplication = SPWebApplication.Lookup(new Uri("http://mysiteurl"));
Below is another error:
The Web application at http://mysiteurl could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
and this happens at line
SPSite site = new SPSite("http://mysiteurl");
Both of the errors have the same root cause.
Solution:
Right Click your project, Choose Properties. Go to tab “Build”, Change Platform Target from “x86” to “Any CPU”. Recompile your project and you will be all set to go.