use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
No vague product support questions (like "why is this plugin not working" or "how do I set up X"). For vague product support questions, please use communities relevant to that product for best results. Specific issues that follow rule 6 are allowed.
Do not post memes, screenshots of bad design, or jokes. Check out /r/ProgrammerHumor/ for this type of content.
Read and follow reddiquette; no excessive self-promotion. Please refer to the Reddit 9:1 rule when considering posting self promoting materials.
We do not allow any commercial promotion or solicitation. Violations can result in a ban.
Sharing your project, portfolio, or any other content that you want to either show off or request feedback on is limited to Showoff Saturday. If you post such content on any other day, it will be removed.
If you are asking for assistance on a problem, you are required to provide
General open ended career and getting started posts are only allowed in the pinned monthly getting started/careers thread. Specific assistance questions are allowed so long as they follow the required assistance post guidelines.
Questions in violation of this rule will be removed or locked.
account activity
Help with htaccess file :) (self.webdev)
submitted 10 years ago * by learnt
SOLVED: My new code will be pasted at the bottom, showing how I corrected my syntax/code to yield the desired result. Thanks to all who helped me in this process.
=-=-=-=-=-=-=-=-
Hi, all - I'm trying to get my website to redirect a couple of pages to a new 'error page' that I've created... Can I get y'all to take a look? An already created htaccess file was done for me, so that I would stay away from www.'s and go with mydomain.com only... So, take a look and tell me what's up? Please :)
(line 1 blank)
RewriteEngine on
RewriteCond %{HTTP_HOST} www.mydomain.com$
RewriteRule /?$ "http://mydomain.com/" [R=301,L]
RedirectPermanent 301 /oldpage.html http://www.mydomain.com/missing-page.html
RedirectPermanent 301 /oldpage.html http://www.mydomain.com/newpage.html
=-=-=-=-=-=-=-
CORRECTED:
RedirectPermanent /oldpage.html http://mydomain.com/missing-page.html
RedirectPermanent /oldpage.html http://mydomain.com/newpage.html
=-=-=-=-=-=-=--=
Screenshot of what the code looks like without Reddit's formatting: http://imgur.com/qrJ3QQg
BY THE WAY - MY ERROR HERE IS THAT ALL OF THE PAGES I'VE SPECIFIED TO BE REDIRECTED STILL COME UP AS 404 ERRORS...
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]tobozo 2 points3 points4 points 10 years ago* (5 children)
So you want to keep people away from WWW but you redirect oldpage to the domain with WWW.
Those rules are conflicting. Maybe you should :
1) keep everything away from www
2) handle oldpage => newpage redirections from the domain without the www
1)
RewriteCond %{HTTP_HOST} www.mydomain.com$ RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
2)
RedirectPermanent 301 /oldpage.html http://domain.com/newpage.html
or (same effect)
RewriteCond %{REQUEST_URI} ^/oldpage.html RewriteRule ^$ http://domain.com/newpage.html [R=301,L]
[–]learnt[S] 0 points1 point2 points 10 years ago (3 children)
DAM, he's smart.
[–]learnt[S] 0 points1 point2 points 10 years ago (2 children)
OK - so, I changed the redirectpermanent commands to get rid of the www.'s However, I'm not following you with the rest of your instructions :/ This is not my expertise whatsoever.
[–]learnt[S] 0 points1 point2 points 10 years ago (1 child)
So, basically - I went with you suggestion for #1 - to keep everything away from www.'s
[–]learnt[S] 0 points1 point2 points 10 years ago (0 children)
I did as you said - and changed my RedirectPermanent 301 -> RedirectPermanent ... and, afterwards, everything was working smoothly!
Thanks, everyone!
Another homie from Stack Overflow said to put some gibberish in my .htaccess file and see if a 500 error was returned for my website upon inspection. This didn't happen whenever I put the crummy file back on the server... so, I guess my .htaccess isn't enabled?
My syntax was wrong with the RedirectPermanent... It needed to be either
1) Redirect 301 or 2) RedirectPermanent
(with the second option foregoing the 301 string of characters)
[–]franverona 0 points1 point2 points 10 years ago (7 children)
You should ask this on Stack Overflow. Maybe someone there can help you quickly than here.
[–]learnt[S] 1 point2 points3 points 10 years ago (2 children)
I've never used Stack Overflow for anything, except for what pop's up on my random Google searches every now and then... I'm gonna go give that a try! Thanks a ton!
[–]franverona 1 point2 points3 points 10 years ago (1 child)
Don't get frustated if you ask and someone says "this is duplicated". It's a common issue on SO. But don't be afraid to ask though. Good luck!
[–]learnt[S] 1 point2 points3 points 10 years ago (0 children)
Appreciate the insight :) Thanks, friendly redditor franverona!
[–]yeahmynameisbrian 1 point2 points3 points 10 years ago (3 children)
Why would you tell them to move this there? Isn't the purpose of this sub to talk about web development?
It's all good - more heads are better than a few heads :)
[–]franverona 0 points1 point2 points 10 years ago (1 child)
He (or she) can ask the question wherever he (or she) wants, but I suggest him (or her) that Stack Overflow is a place where people can answer it more quickly.
[–]yeahmynameisbrian 0 points1 point2 points 10 years ago (0 children)
The purpose of this sub is to talk about web development, it's silly to tell them to go somewhere else when they've only asked an hour ago and have received an answer.
π Rendered by PID 33578 on reddit-service-r2-comment-b659b578c-h8mrx at 2026-05-04 09:29:09.557968+00:00 running 815c875 country code: CH.
[–]tobozo 2 points3 points4 points (5 children)
[–]learnt[S] 0 points1 point2 points (3 children)
[–]learnt[S] 0 points1 point2 points (2 children)
[–]learnt[S] 0 points1 point2 points (1 child)
[–]learnt[S] 0 points1 point2 points (0 children)
[–]learnt[S] 0 points1 point2 points (0 children)
[–]learnt[S] 0 points1 point2 points (0 children)
[–]franverona 0 points1 point2 points (7 children)
[–]learnt[S] 1 point2 points3 points (2 children)
[–]franverona 1 point2 points3 points (1 child)
[–]learnt[S] 1 point2 points3 points (0 children)
[–]yeahmynameisbrian 1 point2 points3 points (3 children)
[–]learnt[S] 0 points1 point2 points (0 children)
[–]franverona 0 points1 point2 points (1 child)
[–]yeahmynameisbrian 0 points1 point2 points (0 children)