i have a .htacces on my server that is supposed to do this:
yo enter to ziced.com/cl/something and rewrites it as ziced.com/cl/index.php?var1=something, however is not working.
you can check that is not working by entering ziced.com/cl/faq versus ziced.com/cl/index.php?var1=faq
here is the .htaccess
AddHandler application/x-httpd-php5 .php
# This is the initialization
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks
#Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteBase /
#chilean redirect
# /cl/var1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^cl/([a-zA-Z0-9\.\*\°\~\,\%\"\'\+\(\)\-]+)/?$ /cl/index.php?var1=$1 [L,QSA]
I might know what the problem is but i dont know how to fix it. The webpage that has the rewrite rule, ziced.com, is an addondomain of metrikstudios.com
ziced.com points to metrikstudios.com/ziced/ so, maybe i should add something like:
RewriteRule ^ziced/cl/([a-zA-Z0-9\.\*\°\~\,\%\"\'\+\(\)\-]+)/?$ /cl/index.php?var1=$1 [L,QSA]
Solved the problem. Added the .htacces inside the subdirectory ziced (metrikstudios.com/ziced). Then it worked perfect.
Hope it works for someone in the future
Related
So for two days I can not understand why this won't work...:
Options -Indexes
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^advice/([a-zA-Z]+)/([0-9]+)/$ advice.php?advice=$1&id=$2
Obviously .htaccess is allowed since I am not able to directory open folders, but why doesn't the link work?
Try turning off multiviews so the server doesn't try and search for that as a file. In addition add the conditions so that it knows it's not looking for a real file or directory it's trying to serve and make the trailing slash optional.
Options -Indexes +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^advice/([a-zA-Z]+)/([0-9]+)/?$ /advice.php?advice=$1&id=$2 [L]
Does your RewriteRule redirect to an existing file?
Try this, it works for me
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /test2/test.php
http://example.com/test2/.htaccess shows the location of the .htaccess file
http://example.com/test2/test.php is a direct link
http://example.com/test2/testX4XX opens the same test.php file using rewrite
I've never had this issue before, setting up on a new work machine and getting some odd issues. Firstly I should point out that it was working fine and after making some seemingly unrelated edits the routing without index.php became an issue.
I enabled:
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
my htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Ive tried a bunch of combinations of this based on stack overflow gthreads. An hour on this seems too long, I can't figure out what's going on.
Step 1 would be to make sure Apache's rewrites are actually working. Try creating a file in your web root named bar.php
#File: bar.php
<p>Hello Bar</p>
And then creating the following in your .htaccess file.
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule foo.php bar.php [L]
</IfModule>
And then try loading the URI foo.php on your server
http://mysite.example.com/foo.php
If your web server correctly redirects to bar.php, then you know Apache's setup correctly. If it doesn't, it means rewrites aren't on. Once you know if rewrites are on or off you'll know where to concentrate your debugging.
I've been looking for my answer for 2 days but since I haven't found it, I finally decided to put my question to you.
I'm using a Brinkster shared host and can access the .htaccess but no Apache configuration. Every folder on the server represents the content of one site (domain). In the root I have a .htaccess where every domain is controled with
RewriteCond %{HTTP:Host} ^(?:www\.)?domainname\.be$
RewriteRule (.*) /folder/$1 [NC,L,NS]
In the folder I have another .htacces file.
I want to rewrite and redirect for prettier URLs
http://www.domainname.com/pag.asp?name=var_name&id=var_id
should look like
http://www.domainname.com/name/
The rewrite bit works with the .htaccess code bellow.
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks -MultiViews
Options FollowSymLinks
AllowOverride All
RewriteBase /folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^name=([a-zA-Z-]+)&id=([0-9]+)$ [NC]
RewriteRule ^/?page\.asp$ /%1? [R=301,L]
</IfModule>
But for some reason www.domainname.com/name/ always gives a 404.
What am I doing wrong?
Any help wouldd be highly appreciated.
Thank you
I have a directory structure like root/user/confirm/index.php
I want to make redirect like
Redirect this url
http://www.site.com/user/confirm/ASd2sasda4ass
To this
http://www.site.com/user/confirm/index.php?confirm=ASd2sasda4ass
I am trying this way
RewriteRule /user/confirm/([^A-Za-z0-9])$ /user/confirm/index.php?confirm=$1 [L,QSA]
It redirects this url properly
http://www.site.com/user/confirm/index.php/ASd2sasda4ass
To
http://www.site.com/user/confirm/index.php?confirm=ASd2sasda4ass
But not working for this url without index.php
http://www.site.com/user/confirm/ASd2sasda4ass
It shows 404 not found error
Please see and suggest any possible way to do this.
Thanks.
UPDATE
Complete codes
Options +FollowSymlinks
RewriteEngine on
<IfModule mod_rewrite.c>
RewriteRule /user/confirm/([^A-Za-z0-9])$ /user/confirm/index.php?confirm=$1 [L,QSA]
</IfModule>
Try this (without confirm.php in the url. You shouldn't need it anyway):
RewriteRule ^user/confirm/(.*)/? user_confirm.php?confirm=$1 [L]
I solved this issue by removing this rewrite rule from root .htaccess
RewriteRule ^/user/confirm/([^A-Za-z0-9])$ /user/confirm/index.php?confirm=$1 [L,QSA]
And placing another .htaccess file in confirm directory to hide index.php and processing query parameter there with following codes.
Options +FollowSymlinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?confirm=$1 [L]
</IfModule>
And now its working without index.php in url. Hope this helps others too with same issue.
I'm having a problem with my .htaccess.
on the phpinfo() page, I see that 'mod_rewrite' is in the 'loaded modules' under 'apache2handler', but my .htaccess does not work..
.htaccess
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php
Do I have an error with .htaccess?
If you have an error with .htaccess Apache will generally give you a 500 response. To be honest, a "cheap" way that I use to make sure I have my configuration correct is to put garbage like "alksdjfalsdkjf" in .htaccess - error 500 means I enabled it, no error means I forgot something. ;)
You might want to check your AllowOverride settings.
Try adding
Options +FollowSymLinks
Above rewrite engine on and see if that works