Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
The entire contents of my .htaccess file currently look like this:
RewriteEngine on
RewriteRule ^([a-z]+)/?$ index.php?page=$1 [NC]
This should replace all urls that look like http://example.com/folder/ with http://example.com/index.php?page=folder
This works fine if I use http://example.com/FOLDER/, but not when I use http://example.com/folder/ - I simply get a 404 error saying that the folder doesn't exist
This shouldn't happen, due to the NC (non-case-sensitive) flag, as far as I'm aware. I've also tried replacing the [a-z] section of the regex with [A-Z], [a-zA-Z] etc, all to no avail
Any solutions or shoves in the right direction would be gratefully received :-)
It may just have been an issue with the setup that my web hosting was using - I've permanently moved the entire site across to my VPS now, where it works fine - many thanks to the people who offered suggestions :-)
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 months ago.
Improve this question
ampersandtarski.github.io is a site generated with docusaurus and hosted by github pages. Currently, during generation docusaurus doesn't detect any broken links. Also, the links at the site work as expected, as long as you use the links from the site themselve.
The weird thing is, that whenever you copy a link and open it in a new tab of your browser, it returs a 404-page-not-found error. Therefor deep linking to specific pages on the site doesn't work as well.
I am amazed by this phenomenon, and I am clueless to where to look for a (direction to a) solution.
Does anybody have an idea on what may cause this undesired effect?
Thanks for reading!
Finaly I figured out what was going wrong. It had to do with the casing. A directory where most of the docs were stored, started with an upper-case character. After changing this all to lowercase, my problem was solved.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I'm trying to write a regex that can match both following lines:
http://ficsgames.org/cgi-bin/show.cgi?ID=364189186;action=save
http://www.ficsgames.org/cgi-bin/show.cgi?ID=364189186;action=save
I've got this:
http:\/\/(www)?ficsgames\.org\/cgi-bin\/show\.cgi\?ID=[0-9]+;action=save
but it doesn't seem to work - http://regex101.com/r/vB2cM3/1
You are missing a dot . inside of your optional group.
(www\.)?
You're missing a \. in your (www)?
You forgot the . after www. (which needs to be escaped)
I've updated your regex link here:
http://regex101.com/r/vB2cM3/4
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I've searched thru various websites and here for one that works but none do.
I need a regex that validates a game server hostname is correct format.
Example:
gost.gflclan.com:27015
And also the normal ip:port
103.18.138.27:27015
The hostname version can also have numbers in the subdomain or main part. And always has 5 numbers in port on both.
I've currently got this but it only works for the ip:port and not the hostname one.
([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}:[0-9]{5})|([a-z].[a-z].[a-z]:[1-9]{5})
Thanks if you can help.
updated :
try:
[^\:]+:[0-9]{5}
dynamically match both:
103.18.138.27:27015
gost.gflclan.com:27015
little explaination:
[^\:]+ --- |> all chars till ':'
:
[0-9]{5} --|> exactly 5 numbers
There is a bit more cleaner code:
(([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})|(\w*.\w*.\w*)):[0-9]{5}
Live demo
You forgot the + after [a-z] and the dot must be escaped:
([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{5})|([a-z]+\.[a-z]+\.[a-z]+\:[0-9]{5})
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I want to configure apache web server to prevent opening my website by ip address.
For example if my website is "domain.com" and my server ip is "111.222.333.444", you should not open my website by entering "111.222.333.444".
How can I do this?
Thanks for your help.
This should work in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
# block request by IP address
RewriteCond %{HTTP_HOST} ^111\.222\.333\.444$
RewriteRule ^ - [F]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I have moved from a free blogging service to my own hosting. I don't have control full control over my old blog engine, but I can rewrite some links via theme creation facilities. That way, I plan to redirect my old users to my new site.
Links such as http://oldomain.com/post/post_id will be written as http://newdomain.com/http://olddomain.com/post/post_id because theming facilities doesn't allow me to get urls relative to root of site.
What I want to do is to redirect http://newdomain.com/http://olddomain.com/post/post_id to http://newdomain.com/post/post_id using a .htaccess file on my new domain.
How can I achieve this using a .htaccess file?
You can use:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+http://[^/]+([^\s]+) [NC]
RewriteRule ^ %1 [R=301,L,NE]