我在我网站的根目录中添加了一个名为xyz
的目录。
当我按网址www.mysite.com/xyz/
打开此新目录时,它会正确打开页面并且网址保持不变www.mysite.com/xyz/
但是当我写www.mysite.com/xyz时,url会变成www.mysite.com/xyz/?from=htaccess&option=com_profile&name=xyz
我想做以下事情:
www.mysite.com/xyz
- 应仅停留在www.mysite.com/xyz
而不是www.mysite.com/xyz/?from=htaccess&option=com_profile&name=xyz
可能因为
而发生RewriteRule ^([\w-]+)\.([\w\.-]*)$ /index.php?from=htaccess&option=com_profile&name=$1.$2 [L,NC,QSA]
如果您想查看实际情况,可以查看dev.songdew.com/thnakyouforthemusic
和dev.songdew.com/thnakyouforthemusic/
你能告诉我如何解决这个问题吗?
添加完整的htaccess文件以供参考
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
php_value error_reporting 2039
<ifModule mod_headers.c>
# Header set Connection keep-alive
</ifModule>
<IfModule mod_expires.c>
ExpiresActive On
<FilesMatch "\.(ico|jpg|jpeg|png|gif)$">
ExpiresDefault "access plus 2 weeks"
</FilesMatch>
<FilesMatch "\.(js|css|swf)$">
ExpiresDefault "access plus 2 days"
</FilesMatch>
</IfModule>
<IfModule mod_deflate.c>
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Or, compress certain file types by extension:
<FilesMatch "\.(css|js|x?html?|php)$">
SetOutputFilter DEFLATE
</FilesMatch>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
RewriteCond %{HTTP_HOST} ^52\.62\.12\.230
RewriteRule ^(.*)$ http://www.songdewtest.loc/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^songdew\.com [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^thankyouforthemusic /thankyouforthemusic/index.php [L,QSA]
RewriteRule ^blog/([\w-]+)/([\w-]+)$ /index.php?option=com_content&view=article&id=$2:$1&catid=143:artist-blog&Itemid=564 [L,NC,QSA]
RewriteRule ^blog$ /index.php?option=com_content&view=category&layout=blog&id=143&Itemid=564 [L,NC,QSA]
RewriteRule ^mynetwork.html /index.php?option=com_fans&task=getfollower_list&frm=dashboard¤t_tab_id=follower_list [L,QSA]
RewriteRule ^playlists.html /index.php?option=com_music&task=adminplaylists [L,QSA]
RewriteRule ^playlists/page([\w-]+)/ /index.php?option=com_music&task=adminplaylists&pg=$1 [L,QSA]
RewriteRule ^playlists/page([\w-]+) /index.php?option=com_music&task=adminplaylists&pg=$1 [L,QSA]
RewriteRule ^playlists/([\w-]+)/([\w-]+) /index.php?option=com_music&task=getplaylist_detail&album_id=$2&list=Playlist [L,QSA]
RewriteRule ^sitemap.html /index.php?option=com_sitemap&view=sitemap [L,QSA]
RewriteRule ^sitemap([\w-]+).html /index.php?option=com_sitemap&view=sitemap&id=$1 [L,QSA]
#RewriteRule music.html /index.php?option=com_find&genre_name=0&index_val=1&index_txt=music [L,QSA]
#RewriteRule ^music/([\w-]+)/$ /index.php?option=com_find&index_txt=music&name=$1 [L,QSA]
RewriteRule ^music/page([\w-]+)/ /index.php?option=com_music&hsearch=music&getpid=$1 [L,QSA]
RewriteRule ^music/([\w-]+)/page([\w-]+)/$ /index.php?option=com_music&hsearch=music&name=$1&getpid=$2 [L,QSA]
RewriteRule ^music/([\w-]+)/$ /index.php?option=com_music&task=getLatest&view=mymusic&hsearch=music&name=$1 [L,QSA]
RewriteRule ^music.html /index.php?option=com_music&task=getLatest&view=mymusic&hsearch=music&lang=0&genre_name=0 [L,QSA]
RewriteRule ^musicpremiere/([\w-]+)$ /musicpremiere/singer-page.php [L,QSA]
# RewriteRule ^musicpremiere/([\w-]+)/([\w-]+)/([\w-]+)$ /index.php?option=com_cdlabel&task=musicpremier&cd_id=$3&tmpl=musicpremier
RewriteRule ^musicpremiere/([\w-]+)/([\w-]+)/([\w-]+)$ /index.php?option=com_cdlabel&task=musicpremier&cd_id=$3&threecol=1 [L,QSA]
#RewriteRule ^music-video/([\w-]+)/$ /index.php?option=com_find&index_txt=video&name=$1 [L,QSA]
#RewriteRule ^artist/([\w-]+)/$ /index.php?option=com_find&index_txt=artist&name=$1 [L,QSA]
RewriteRule ^artist/page([\w-]+)/ /index.php?option=com_find&task=getlistAll&view=find&hsearch=artist&index_val=1&getpid=$1 [L,QSA]
RewriteRule ^artist/([\w-]+)/page([\w-]+)/ /index.php?option=com_find&task=getlistAll&view=find&hsearch=artist&name=$1&getpid=$2 [L,QSA]
RewriteRule ^artist/([\w-]+)/$ /index.php?option=com_find&task=getlistAll&view=find&hsearch=artist&name=$1 [L,QSA]
RewriteRule ^artist/([\w-]+)/([\w-]+)$ /index.php?option=com_find&task=getlistAll&view=find&hsearch=artist&name=$1&srch_name=$2 [L,QSA]
#RewriteRule music.html /index.php?option=com_find&genre_name=0&index_txt=music&index_val=1 [L,QSA]
#RewriteRule video.html /index.php?option=com_find&genre_name=0&index_txt=video&index_val=1 [L,QSA]
RewriteRule ^music-video/page([\w-]+)/$ /index.php?option=com_videos&hsearch=video&getpid=$1 [L,QSA]
RewriteRule ^music-video/([\w-]+)/page([\w-]+)/$ /index.php?option=com_videos&hsearch=video&name=$1&getpid=$2 [L,QSA]
RewriteRule ^music-video/([\w-]+)/$ /index.php?option=com_videos&task=getLatest&view=myvideos&hsearch=video&name=$1 [L,QSA]
RewriteRule ^video.html /index.php?option=com_videos&task=getLatest&view=myvideos&hsearch=video&lang=0&genre_name=0 [L,QSA]
#RewriteRule artist.html /index.php?option=com_find&genre_name=0&index_txt=artist&index_val=1 [L,QSA]
RewriteRule ^artist.html /index.php?option=com_find&task=getlistAll&view=find&hsearch=artist [L,QSA]
RewriteRule ^store.html /index.php?option=com_virtuemart&from=htaccess [L,QSA]
#RewriteRule gigs.html /index.php?option=com_find&index_txt=gigs [L,QSA]
RewriteRule ^gigs/page([\w-]+)/ /index.php?option=com_shows&task=getmy_shows&hsearch=gigs&getpid=$1 [L,QSA]
RewriteRule ^gigs.html /index.php?option=com_shows&task=getmy_shows&hsearch=gigs [L,QSA]
RewriteRule ^search.html /index.php?option=com_find&cpanel=hide&keyword=Search&Itemid=547 [L,QSA]
RewriteRule livebuzz.html /index.php?option=com_livefeed&Itemid=478&from=htaccess [L,QSA]
#RewriteRule classifieds.html /index.php?option=com_find&index_txt=classifieds [L,QSA]
RewriteRule ^classifieds/page([\w-]+)/$ /index.php?option=com_annonces&task=getlistings&hsearch=classifieds&getpid=$1 [L,QSA]
RewriteRule ^classifieds.html /index.php?option=com_annonces&task=getlistings&hsearch=classifieds [L,QSA]
RewriteRule ^contests.html index.php?option=com_contest&task=getContestlist [L,QSA]
#RewriteRule ^contests.html /index.php?option=com_contest&task=getcontestlist&view=contest&layout=contestlist [L,NC,QSA]
RewriteRule ^contests/page([\w-]+)/ /index.php?option=com_contest&task=getcontestlist&view=contest&getpid=$1 [L,QSA]
RewriteRule ^contests/Collaborate-with-Deepak-Ram/1$ /index.php?option=com_content&view=article&id=71 [L,QSA]
RewriteRule ^contests/([\w-]+)/([\w-]+)$ /index.php?option=com_contest&task=getContestTask&view=contest&contestname=$1&contestid=$2 [L,QSA]
RewriteRule ^contests/([\w-]+)$ /index.php?option=com_contest&task=$1&view=contest&layout=$1 [L,QSA]
RewriteRule ^signin.html /index.php?option=com_users&view=login [L,QSA]
RewriteRule ^logout.html /index.php?option=com_users&task=user.logout [L,QSA]
RewriteRule ^aboutus.html /index.php?option=com_content&Itemid=507&view=article&id=72 [L,QSA]
RewriteRule ^privacy_policy.html /index.php?option=com_content&Itemid=487&view=article&id=8 [L,QSA]
RewriteRule ^disclaimer_policy.html /index.php?option=com_content&Itemid=488&view=article&id=22 [L,QSA]
RewriteRule ^refund_policy.html /index.php?option=com_content&Itemid=508&view=article&id=73 [L,QSA]
RewriteRule ^terms_services.html /index.php?option=com_content&Itemid=509&view=article&id=74 [L,QSA]
RewriteRule ^shipping_policy.html /index.php?option=com_content&Itemid=510&view=article&id=75 [L,QSA]
RewriteRule ^reportabuse.html /index.php?option=com_videos&Itemid=513&view=reportabuse [L,QSA]
RewriteRule ^songdew.html /index.php?option=com_content&id=69&view=article [L,QSA]
RewriteRule ^listener.html /index.php?option=com_content&id=68&view=article [L,QSA]
RewriteRule ^artists.html /artist.html [L,R=301]
RewriteRule ^spread_music.html /index.php?option=com_content&id=59&view=article [L,QSA]
RewriteRule ^collaborate.html /index.php?option=com_content&id=60&view=article [L,QSA]
RewriteRule ^sell_music.html /index.php?option=com_content&id=61&view=article [L,QSA]
#RewriteRule 404.html /index.php?option=com_content&view=article&id=87&Itemid=124 [L,QSA]
RewriteRule ^artist-promotional-tools.html /index.php?option=com_artist&task=page_display&layout=promote [L,QSA]
RewriteRule ^disclaimer.html /index.php?option=com_artist&task=page_display&layout=disclaimer [L,QSA]
RewriteRule ^privacy-policy.html /index.php?option=com_artist&task=page_display&layout=ppolicy [L,QSA]
RewriteRule ^refund-policy.html /index.php?option=com_artist&task=page_display&layout=refund [L,QSA]
RewriteRule ^shipping-policy.html /index.php?option=com_artist&task=page_display&layout=shipping [L,QSA]
RewriteRule ^terms-of-services.html /index.php?option=com_artist&task=page_display&layout=tservices [L,QSA]
RewriteRule ^career.html /index.php?option=com_artist&task=page_display&layout=careers [L,QSA]
RewriteRule ^faqs.html /index.php?option=com_artist&task=page_display&layout=faqs [L,QSA]
RewriteRule ^contact-us.html /index.php?option=com_contact&view=contact&id=1 [L,QSA]
RewriteRule ^about.html /index.php?option=com_artist&task=page_display&layout=aboutus [L,QSA]
RewriteRule ^network.html /index.php?option=com_content&view=article&id=21 [L,QSA]
RewriteRule ^publish.html /index.php?option=com_content&view=article&id=79 [L,QSA]
RewriteRule ^showcase.html /index.php?option=com_content&view=article&id=80 [L,QSA]
RewriteRule ^promote.html /index.php?option=com_content&view=article&id=81 [L,QSA]
RewriteRule ^sell.html /index.php?option=com_content&view=article&id=82 [L,QSA]
RewriteRule ^livetv.html /index.php?option=com_songdewlive&view=livetv [L,QSA]
RewriteRule ^press_releases.html /index.php?option=com_content&view=category&layout=blog&id=78&Itemid=514 [L,QSA]
RewriteRule ^sitemap.html /index.php?option=com_content&view=article&id=89&Itemid=551 [L,QSA]
RewriteRule ^freethemusic/home.html /freethemusic/home.php [L,QSA]
RewriteRule ^freethemusic/gallery/([\w-]+)$ /freethemusic/gallery.php?gallery=$1 [L,QSA]
RewriteRule ^freethemusic/gallery.html /freethemusic/gallery.php [L,QSA]
RewriteRule ^freethemusic/events.html /freethemusic/events.php [L,QSA]
RewriteRule ^freethemusic/about.html /freethemusic/about.php [L,QSA]
RewriteRule ^freethemusic/contest.html /freethemusic/contest.php [L,QSA]
RewriteRule ^freethemusic/contactus/([\w-]+)$ /freethemusic/contactus.php?form=$1 [L,QSA]
RewriteRule ^freethemusic/contactus.html /freethemusic/contactus.php [L,QSA]
RewriteRule ^freethemusic/artists.html /freethemusic/artistprofile.php [L,QSA]
RewriteRule ^freethemusic/login.html /freethemusic/login.php [L,QSA]
RewriteRule ^freethemusic/terms.html /freethemusic/terms.php [L,QSA]
RewriteRule ^freethemusic/contactus_artist.html /freethemusic/contactus_artist.php [L,QSA]
RewriteRule ^freethemusic/badnaam$ /freethemusic/artist_page.php?artist_id=10236 [L,QSA]
RewriteRule ^freethemusic/badnaam/([\w-]+)$ /freethemusic/artist_page.php?artist_id=10236&gallery=$1 [L,QSA]
RewriteRule ^freethemusic/chinmayi$ /freethemusic/artist_page.php?artist_id=896 [L,QSA]
RewriteRule ^freethemusic/chinmayi/([\w-]+)$ /freethemusic/artist_page.php?artist_id=896&gallery=$1 [L,QSA]
RewriteRule ^freethemusic/joel$ /freethemusic/artist_page.php?artist_id=5811 [L,QSA]
RewriteRule ^freethemusic/joel/([\w-]+)$ /freethemusic/artist_page.php?artist_id=5811&gallery=$1 [L,QSA]
RewriteRule ^freethemusic/northeastbreeze$ /freethemusic/artist_page.php?artist_id=10219 [L,QSA]
RewriteRule ^freethemusic/northeastbreeze/([\w-]+)$ /freethemusic/artist_page.php?artist_id=10219&gallery=$1 [L,QSA]
RewriteRule ^freethemusic/pratigya$ /freethemusic/artist_page.php?artist_id=2711 [L,QSA]
RewriteRule ^freethemusic/pratigya/([\w-]+)$ /freethemusic/artist_page.php?artist_id=2711&gallery=$1 [L,QSA]
RewriteRule ^freethemusic/tungztn$ /freethemusic/artist_page.php?artist_id=2383 [L,QSA]
RewriteRule ^freethemusic/tungztn/([\w-]+)$ /freethemusic/artist_page.php?artist_id=2383&gallery=$1 [L,QSA]
RewriteRule ^freethemusic/userprofile/([\w-]+) /freethemusic/user-profile.php?user_id=$1 [L,QSA]
RewriteRule ^freethemusic/gallery/chinmayi/([\w-]+)$ /freethemusic/gallery.php?userid=896&gallery=$1 [L,QSA]
RewriteRule ^freethemusic/gallery/badnaam/([\w-]+)$ /freethemusic/gallery.php?userid=10236&gallery=$1 [L,QSA]
RewriteRule ^freethemusic/gallery/pratigya/([\w-]+)$ /freethemusic/gallery.php?userid=2711&gallery=$1 [L,QSA]
RewriteRule ^freethemusic/gallery/northeastbreeze/([\w-]+)$ /freethemusic/gallery.php?userid=10219&gallery=$1 [L,QSA]
RewriteRule ^freethemusic/gallery/joel/([\w-]+)$ /freethemusic/gallery.php?userid=5811&gallery=$1 [L,QSA]
RewriteRule ^freethemusic/gallery/tungztn/([\w-]+)$ /freethemusic/gallery.php?userid=2383&gallery=$1 [L,QSA]
# END - URL LIST TO PARSE
RewriteCond %{REQUEST_URI} !^/staging/$
RewriteCond %{REQUEST_URI} !^/webmail/$
RewriteCond %{REQUEST_URI} !^/mobile$
RewriteCond %{REQUEST_URI} !^/mobile/$
RewriteCond %{REQUEST_URI} !^/freethemusic
RewriteCond %{REQUEST_URI} !^/freethemusic/$
RewriteCond %{REQUEST_URI} !^/aircelfreethemusic/$
RewriteCond %{REQUEST_URI} !^/aircelfreethemusic$
RewriteCond %{REQUEST_URI} !^/administrator/$
RewriteCond %{REQUEST_URI} !^/channel\.php/$
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteCond %{REQUEST_URI} !^/upload\.php$
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REQUEST_URI} !/facebookcheck.html$
RewriteCond %{REQUEST_URI} !/site_under.jpg$
RewriteCond %{REQUEST_URI} !^/robots\.txt$
RewriteCond %{REQUEST_URI} !^/sitemap\.php$
RewriteCond %{REQUEST_URI} !^/sitemap1\.php$
RewriteCond %{REQUEST_URI} !^/sitemap_old\.php$
RewriteCond %{REQUEST_URI} !^/sitemap\.xml$
RewriteCond %{REQUEST_URI} !^/sitemap[0-9]\.xml$
RewriteRule ^([\w-]+)\.([\w\.-]*)$ /index.php?from=htaccess&option=com_profile&name=$1.$2 [L,NC,QSA]
RewriteRule ^([\w-]+)$ /index.php?from=htaccess&option=com_profile&name=$1 [L,NC,QSA]
RewriteRule ^([\w-]+)\.([\w\.-]*)/(songs|videos|photos|playlists|followers|following|store|events)/$ /index.php?from=htaccess&option=com_profile&name=$1.$2&tab_id=$3 [L,NC,QSA]
RewriteRule ^([\w-]+)\.([\w\.-]*)/(songs|videos|photos|playlists|followers|following|store|events)/page([\w-]+)$ /index.php?from=htaccess&option=com_profile&name=$1.$2&tab_id=$3&pg=$4 [L,NC,QSA]
RewriteRule ^([\w-]+)/(songs|videos|photos|playlists|followers|following|store|events)/$ /index.php?from=htaccess&option=com_profile&name=$1&tab_id=$2 [L,NC,QSA]
RewriteRule ^([\w-]+)/(songs|videos|photos|playlists|followers|following|store|events)/page([\w-]+)$ /index.php?from=htaccess&option=com_profile&name=$1&tab_id=$2&pg=$3 [L,NC,QSA]
RewriteRule ^classifieds/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)$ /index.php?cpanel=hide&option=com_annonces&view=display&taskval=getlistings&location=$1&category=$2&title=$3&classifiedId=$4 [L,NC,QSA]
RewriteRule ^events/([\w-]+)/([\w-]+)/([\w-]+)$ /index.php?cpanel=hide&option=com_shows&view=display&taskval=getshow_list&location=$1&title=$2&id=$3 [L,NC,QSA]
RewriteRule ^song/([\w-]+)\.([\w\.-]+)/([\w-]+)/([\w-]+)$ /index.php?option=com_music&from=htaccess&view=display&cpanel=hide&frompage=hsearch&artist=$1.$2&title=$3&id=$4 [L,NC,QSA]
RewriteRule ^song/([\w-]+)/([\w-]+)/([\w-]+)$ /index.php?option=com_music&view=display&from=htaccess&cpanel=hide&frompage=hsearch&artist=$1&title=$2&id=$3 [L,NC,QSA]
RewriteRule ^video/([\w-]+)\.([\w\.-]+)/([\w-]+)/([\w-]+)$ /index.php?cpanel=hide&from=htaccess&frompage=hsearch&option=com_videos&view=display&artist=$1.$2&title=$3&id=$4 [L,NC,QSA]
RewriteRule ^video/([\w-]+)/([\w-]+)/([\w-]+)$ /index.php?cpanel=hide&from=htaccess&frompage=hsearch&option=com_videos&view=display&artist=$1&title=$2&id=$3 [L,NC,QSA]
<IfModule mod_expires.c>
ExpiresActive On
############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 1 year"
</FilesMatch>
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
############################################
## rewrite everything else to index.php
#RewriteRule .* 404.html [L]
答案 0 :(得分:1)
这是因为mod_dir
模块在真实目录前面附加了一个斜杠。
您应该跳过规则中的文件和目录:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)\.([\w\.-]*)$ /index.php?from=htaccess&option=com_profile&name=$1.$2 [L,QSA]