Im trying to redirect to different pages. But it isn't working does anyone know how to fix it?
RewriteRule ^test assets/php/test/home.php [NC,L]
RewriteRule ^test/([0-9a-zA-Z]+) assets/php/test/menu.php?id=$1 [NC,L]
RewriteRule ^test/([0-9a-zA-Z]+)/([0-9a-zA-Z]+) assets/php/test/player.php?id=$1&sec=$2 [NC,L]
RewriteRule ^test/(.*)/(.*)$ assets/php/test/player.php?id=$1&sec=$2&type=dir [NC,L]
RewriteRule ^test/(.*)$ assets/php/test/testmenu.php?id=$1&type=dir [NC,L]
Related
I need help with my htaccess file. I added the following to remove all .php extensions which is working fine.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
However I have a directory /users which I want to rewrite the URL strings. The current URL is like this:
aero.site/maki/users/index.php?t=mf5cc
I want the URL to look like
aero.site/maki/mf5cc
I used the following rewrite rule but it's giving me Object not found error:
RewriteRule ^([^/.]+)$ users/index.php?t=$1 [L]
My complete htaccess content is
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^/.]+)$ users/index.php?t=$1 [L]
Kindly help me with the correct rewrite rule for the last line to turn aero.site/maki/users/index.php?t=mf5cc into aero.site/maki/mf5cc
FYI: my htaccess file is in aero.site/maki directory
I finally got it to work. Thanks to #misorude. Here's my updated .htaccess content:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^/.]+)$ users/index?t=$1 [L]
The following .htaccess stopped working a couple of months ago and I cannot figure out why.
Options FollowSymLinks
RewriteEngine On
RewriteRule ^home*$ index.php [NC,L]
RewriteRule ^dashboard*$ index.php?view=dashboard [NC,L]
RewriteRule ^new-safar*$ index.php?view=new-safar [NC,L]
RewriteRule ^safars*$ index.php?view=safars [NC,L]
RewriteRule ^active-safars*$ index.php?view=active-safars [NC,L]
RewriteRule ^pre-registration*$ index.php?view=pre-registration [NC,L]
RewriteRule ^safars/kun-safar/([0-9]+)/edit-registration/([0-9]+) index.php?view=edit-kun-registration&safarid=$1&kunregid=$2 [NC,L]
RewriteRule ^safars/kun-safar/([0-9]+)/new-registration index.php?view=new-kun-registration&safarid=$1 [NC,L]
RewriteRule ^safars/kun-safar/([0-9]+)/new-pre-registration index.php?view=new-kun-preregistration&safarid=$1 [NC,L]
RewriteRule ^safars/kun-safar/([0-9]+) index.php?view=kun-safar&safarid=$1 [NC,L]
RewriteRule ^oops index.php?view=oops [NC,L]
RewriteRule ^register-yourself register-yourself.php [NC,L]
RewriteRule ^its-verification*$ its_verifications.php [NC,L]
For example, this url https://zadmin.colomboshabab.com/safars is giving a 404 Error.
The site is going through cloudflare but it was working earlier. It is hosted on a GoDaddy server.
I have this url
www.mysite.com/proyecto.php?id=3
and want this type of url
www.mysite.com/proyecto/id/3
I remember using this kind of code but is not working, any idea please?
<ifModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteRule proyecto/id/(.*)/ proyecto.php?id=$1
RewriteRule proyecto/id/(.*) proyecto.php?id=$1
RewriteRule ^([^\.]+)$ $1.php [NC,L]
ErrorDocument 404 /error404.php
</ifModule>
Finally I improved a bit and I did www.mysite.com/proyecto/1 width the following code in the .htaccess
Thanks for the help!
RewriteEngine On
RewriteRule ^proyecto/([0-9]+)/?$ proyecto.php?id=$1 [NC,L]
Your code sample looks very confusing and does not match your verbal description at all. If I got you right, this is main part you are looking for:
RewriteCond %{HTTP_HOST} ^www\.mysite\.com$
RewriteCond %{REQUEST_URI} !^proyecto/id/(\d+)/? [NC]
RewriteCond %{QUERY_STRING} ^id=(\d+) [NC]
RewriteRule ^.*$ proyecto/id/%1/? [NC,L,R=301]
my apache error log is full of this, I don't know what is wrong. This is my .htaccess file. Can somebody help me?
RewriteEngine on
# check that the request url is neither a file nor a directory
RewriteRule ^panel/?$ panel/ [NC,L]
RewriteRule ^([A-Za-z0-9-]+)/?$ app.php?slug=$1 [NC,L]
RewriteRule ^([A-Za-z0-9-]+)/index/([A-Za-z0-9-]+)/?$ app.php?slug=$1&index=$2 [NC,L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule \.(gif|jpg|png|bmp) /images/default.jpg [NC,L]
and I have another subdomain who redirects to this. And htaccess:
RewriteEngine on
RewriteRule ^(.*)$ http://ro.sughy.com/$1 [R=301,L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule \.(gif|jpg|png|bmp) /images/default.jpg [NC,L]
This is my url http://www.example.com/demo/
what's wrong with my htaccess file? and how to slove it?
thank you in advance
#CHECK MOD REWRITE ON IN HOSTING SERVER
Options +FollowSymLinks
RewriteEngine on
#REWRITE URL FOR ALL PHP FILE TO HTML
RewriteBase /demo/
RewriteRule ^home\.html$ index.php?page=$1&lang=$2 [NC,L]
RewriteRule ^h([a-zA-Z0-9\-_\.\/]+)-([a-zA-Z0-9\-_\.\/]+)\.html$ index.php?page=$1&lang=$2 [NC,L]
RewriteRule ^p([a-zA-Z0-9\-_\.\/]+)-([a-zA-Z0-9\-_\.\/]+)\.html$ product.php?page=$1&lang=$2 [NC,L]
RewriteRule ^s([a-zA-Z0-9\-_\.\/]+)-([a-zA-Z0-9\-_\.\/]+)\.html$ service.php?page=$1&lang=$2 [NC,L]
RewriteRule ^a([a-zA-Z0-9\-_\.\/]+)-([a-zA-Z0-9\-_\.\/]+)\.html$ about.php?page=$1&lang=$2 [NC,L]
RewriteRule ^c([a-zA-Z0-9\-_\.\/]+)-([a-zA-Z0-9\-_\.\/]+)\.html$ contact.php?page=$1&lang=$2 [NC,L]