Forum Moderators: phranque

Message Too Old, No Replies

Problem with my internal redirect not working

         

Davvit

6:45 pm on Sep 1, 2016 (gmt 0)

5+ Year Member



Hi,

I have am using pseudo sub-domains and redirecting them to a query.

This has worked fine for me on other websites ( on the same server ) but
I can not get it to work now ?

This is my .htacess file:


The rules I am trying to get working are:
the: # GETTING PLATFORM NAME rules ( see below )


Options +SymLinksifOwnerMatch
RewriteEngine On

# BELOW IS STUFF TO BLOCK SPAMMING ATTACKS
######################################################
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [OR]

# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR]

# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]

# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]

# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})

# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [NC,L]
#
######################################################

# GETTING PLATFORM AND PAGE NO
# http://big-blue-widget.example.com/big-widgets/greatest-gadget/p1pg2.html

RewriteRule ^[\.0-9,:\/-a-z]+p([0-9]+)pg([0-9]+)\.html$ index.php?p=$1&pg=$2 [NC,QSA,L]

# GETTING PLATFORM AND PAGE NO
# http://big-blue-widget.example.com/big-widgets/greatest-gadget/p1pg2.html

RewriteRule ^[\.0-9,:\/-a-z]+p([0-9]+)pg([0-9]+)\.html$ index.php?p=$1&pg=$2 [NC,QSA,L]

# GETTING PLATFORM AND CAT POSITION
# http://big-blue-widget.example.com/big-widgets/p1c9k7.html

RewriteRule ^[\.0-9,:\/-a-z]+p([0-9]+)c([0-9]+)k([0-9]+)\.html$ index.php?p=$1&c=$2&k=$3 [NC,QSA,L]


# GETTING PLATFORM AND CLIENT NO
RewriteRule ^[\.0-9,:\/-a-z]+p([0-9]+)cl([0-9]+)\.html$ index.php?p=$1&cl=$2 [NC,L]

# GETTING PLATFORM NAME
RewriteCond %{HTTP_HOST} ^(.+).example.org$ [NC]
RewriteCond %{HTTP_HOST} !^www.example.org$ [NC]

RewriteRule ^.*$ http://example.org/index.php?n=%1 [NC,QSA,L]

# I have deliberately commented out the rules below.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ http://example.org/index.php?m=$1&pg=1 [NC,QSA,L]


When I try this address: red-widgets.example.org
I get this notice:
This site can’t be reached
red-widgets.example.org’s server DNS address could not be found.


If you enter the ... example.org/index.php?n=red-widgets
then you see the site .

then other links will not work either :(

Can you see what I have done wrong ?

Many thanks for any help !
David.

[edited by: not2easy at 8:10 pm (utc) on Sep 1, 2016]
[edit reason] Please remember to use example.com or example.org and not post specifics [/edit]

whitespace

10:05 pm on Sep 1, 2016 (gmt 0)

10+ Year Member Top Contributors Of The Month



This site can’t be reached
red-widgets.example.org’s server DNS address could not be found.


As the error states, you have a problem with your DNS. It sounds like you need to have a "wildcard" subdomain (ie.*) configured in the DNS zone for example.org. This has nothing to do with .htaccess. "This site can't be reached" - Your site is not even being reached, no request is getting through to your server.

Davvit

10:03 am on Sep 2, 2016 (gmt 0)

5+ Year Member



Yes - I had forgotten about that !
Thanks